I use a few Python files to generate problems with solutions (and figures or tables where needed) for the exams. They are mostly written in Jupyter notebook. There are comments but possibly not enough (and moreover they are half Italian and half English). By looking at the code you'll see that in some files you have to enter parameter values of your choice, while other files load random numbers so you just have to run them and see the results. If anyone is interested just email me, I would be happy to add explanations.
The files - those with extension .py or .ipynb - can be downloaded here.
- monopoly-dwl.py computes monopoly equilibrium and dead-weight loss in a simple linear setting
- lr-compSym.ipynb computes long-run competitive equilibrium (including number of firms and firm profit in equilibrium and everything else)
- MaxU.ipynb computes consumer otimum with two goods, with any utility you specify in the file
- ConsMaxMzeroX.py, ConsMaxMzeroY.ipynb, FirmMaxQzeroL.ipynb take quasilinear functions (any one you specify) and computes for consumer the maximum income for which a good is not consumed and for firm the maximum production level for which an input is not used
- BasicPILtable.ipynb computes PIL (GDP) nominal and with a cetain base and relative growth rates - random numbers in the file, and latex table exporting commands are included
- PILwithMachines.ipynb computes PIL, investments, depreciation, checks equality Delta K = I - Depreciation, and more in an economy with machines of various vintages. Here too random numbers included (for Latex exporting we can copy from the previous file)