The purpose of this code is to aid in expressing and solving sets of equations using Python.
This tool will take a textual description of the equations and then run the solver iteratively until it converges to a solution.
The solver provides the following choices for solving: - Gauss-Seidel - Newton-Raphson - Broyden
It also uses parts of sympy to aid in parsing the equations.
The initial motivation for this tool was to solve economic models based on Stock Flow Consistent (SFC) models.
- ::
- pip install pysolve
- For additional examples, view the iPython notebooks at
- http://nbviewer.ipython.org/github/kennt/monetary-economics/tree/master/
- A short tutorial with more explanation is available at
- http://nbviewer.ipython.org/github/kennt/monetary-economics/blob/master/extra/pysolve%20tutorial.ipynb
- Sparse matrix support (memory improvements for large systems)
- Documentation
- Tutorial
- Improved documentation
- Tutorial
- Added support for solving with Broyden's method
- Optimized the code for Broyden and Newton-Raphson, should be much faster now.
- Added the d() function. Implements the difference between the current value
and the value from a previous iteration. d(x) is equivalent to x - x(-1) - Added support for the following sympy functions: abs, Min, Max, sign, sqrt - Added some helper functions to aid in debugging larger models - Added support for solving via Newton-Raphson
- Improved error reporting when unable to solve an equation (due to variable
missing a value). - Also, evaluate() used to require that all variables have a value, but that may not be true on initialization, so this requirement has been removed.
- Added support for the exp() and log() functions.
- Fixed a bug where the usage of '>=' within an if_true() would cause an error.