{ "info": { "author": "Kenn Takara", "author_email": "kenn.takara@outlook.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "Intended Audience :: Science/Research", "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Topic :: Scientific/Engineering :: Mathematics" ], "description": "==========\r\npysolve\r\n==========\r\nSolving systems of equations\r\n-----------------------------------\r\n\r\nThe purpose of this code is to aid in expressing and solving\r\nsets of equations using Python.\r\n\r\nThis tool will take a textual description of the equations \r\nand then run the solver iteratively until it converges to a solution.\r\n\r\nThe solver provides the following choices for solving:\r\n\r\n- Gauss-Seidel\r\n- Newton-Raphson\r\n- Broyden\r\n\r\nIt also uses parts of sympy to aid in parsing the equations.\r\n\r\nThe initial motivation for this tool was to solve economic\r\nmodels based on Stock Flow Consistent (SFC) models.\r\n\r\n\r\nInstallation\r\n--------------\r\n\tpip install pysolve\r\n\r\n\r\nUsage\r\n-------------\r\n\r\n.. code::\r\n\tfrom pysolve.model import Model\r\n\tfrom pysolve.utils import round_solution,is_close\r\n\r\n\tmodel = Model()\r\n\r\n\tmodel.set_var_default(0)\r\n\tmodel.var('Cd', desc='Consumption goods demand by households')\r\n\tmodel.var('Cs', desc='Consumption goods supply')\r\n\tmodel.var('Gs', desc='Government goods, supply')\r\n\tmodel.var('Hh', desc='Cash money held by households')\r\n\tmodel.var('Hs', desc='Cash money supplied by the government')\r\n\tmodel.var('Nd', desc='Demand for labor')\r\n\tmodel.var('Ns', desc='Supply of labor')\r\n\tmodel.var('Td', desc='Taxes, demand')\r\n\tmodel.var('Ts', desc='Taxes, supply')\r\n\tmodel.var('Y', desc='Income = GDP')\r\n\tmodel.var('YD', desc='Disposable income of households')\t\r\n\r\n\t# This is a shorter way to declare multiple variables\r\n\t# model.vars('Y', 'YD', 'Ts', 'Td', 'Hs', 'Hh', 'Gs', 'Cs',\r\n\t# 'Cd', 'Ns', 'Nd')\r\n\tmodel.param('Gd', desc='Government goods, demand', initial=20)\r\n\tmodel.param('W', desc='Wage rate', initial=1)\r\n\tmodel.param('alpha1', desc='Propensity to consume out of income', initial=0.6)\r\n\tmodel.param('alpha2', desc='Propensity to consume o of wealth', initial=0.4)\r\n\tmodel.param('theta', desc='Tax rate', initial=0.2)\r\n\r\n\tmodel.add('Cs = Cd')\r\n\tmodel.add('Gs = Gd')\r\n\tmodel.add('Ts = Td')\r\n\tmodel.add('Ns = Nd')\r\n\tmodel.add('YD = (W*Ns) - Ts')\r\n\tmodel.add('Td = theta * W * Ns')\r\n\tmodel.add('Cd = alpha1*YD + alpha2*Hh(-1)')\r\n\tmodel.add('Hs - Hs(-1) = Gd - Td')\r\n\tmodel.add('Hh - Hh(-1) = YD - Cd')\r\n\tmodel.add('Y = Cs + Gs')\r\n\tmodel.add('Nd = Y/W')\r\n\r\n\t# solve until convergence\r\n\tfor _ in xrange(100):\r\n\t model.solve(iterations=100, threshold=1e-3)\r\n\r\n\t prev_soln = model.solutions[-2]\r\n\t soln = model.solutions[-1]\r\n\t if is_close(prev_soln, soln, rtol=1e-3):\r\n\t break\r\n\r\n\tprint round_solution(model.solutions[-1], decimals=1)\r\n\r\nFor additional examples, view the iPython notebooks at\r\n\thttp://nbviewer.ipython.org/github/kennt/monetary-economics/tree/master/\r\n\r\n\r\nTutorial\r\n--------\r\nA short tutorial with more explanation is available at\r\n\thttp://nbviewer.ipython.org/github/kennt/monetary-economics/blob/master/extra/pysolve%20tutorial.ipynb\r\n\r\nTODO list\r\n---------\r\n- Sparse matrix support (memory improvements for large systems)\r\n- Documentation\r\n\r\n\r\nChangelog\r\n---------\r\n\r\n0.2.0 (in progress)\r\n-------------------\r\n- Tutorial\r\n- Improved documentation\r\n\r\n0.1.7\r\n-----\r\n- Tutorial\r\n\r\n0.1.6\r\n-----\r\n- Added support for solving with Broyden's method\r\n- Optimized the code for Broyden and Newton-Raphson, should be much faster now.\r\n\r\n0.1.5\r\n-----\r\n- 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)\r\n- Added support for the following sympy functions: abs, Min, Max, sign, sqrt\r\n- Added some helper functions to aid in debugging larger models\r\n- Added support for solving via Newton-Raphson\r\n\r\n0.1.4\r\n-----\r\n- Improved error reporting when unable to solve an equation (due to variable missing a value).\r\n- 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.\r\n\r\n0.1.3 (and before)\r\n------------------\r\n- Added support for the exp() and log() functions.\r\n- Fixed a bug where the usage of '>=' within an if_true() would cause an error.", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/kennt/pylinsolve", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pysolve", "package_url": "https://pypi.org/project/pysolve/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/pysolve/", "project_urls": { "Homepage": "https://github.com/kennt/pylinsolve" }, "release_url": "https://pypi.org/project/pysolve/0.1.7/", "requires_dist": null, "requires_python": null, "summary": "A simple interface for solving systems of equations", "version": "0.1.7" }, "last_serial": 1239847, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "2330ff4eee63879328e1dbb00a53c76d", "sha256": "e78e26c2caeee9cd87144553b03f63949cc8e5798da989257c839e99ee956194" }, "downloads": -1, "filename": "pysolve-0.1.tar.gz", "has_sig": false, "md5_digest": "2330ff4eee63879328e1dbb00a53c76d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18661, "upload_time": "2014-09-10T05:10:50", "url": "https://files.pythonhosted.org/packages/72/29/b0d9255cf807110a89bfad8f312239d19027d81f3bb3d6652e073bdaa28e/pysolve-0.1.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "c3d65582aa9e22268d01b5065936bced", "sha256": "fc9d3e25b4e72df20e8021835fa4d7a72e6f40cd21b2cc67368db219392f5615" }, "downloads": -1, "filename": "pysolve-0.1.1.tar.gz", "has_sig": false, "md5_digest": "c3d65582aa9e22268d01b5065936bced", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17253, "upload_time": "2014-09-10T11:56:02", "url": "https://files.pythonhosted.org/packages/75/8d/89ceeae431922dc9d7aa043bc8ed58ecc5e8e0699ad6060ae6fe786997b5/pysolve-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "0be129f4976fd3044eb5ee3df67fae85", "sha256": "98bb8cfb9c6fbe2384a2d473f6bae08b3c6cee2e886d6d55822bf57c0f1d28d4" }, "downloads": -1, "filename": "pysolve-0.1.2.tar.gz", "has_sig": false, "md5_digest": "0be129f4976fd3044eb5ee3df67fae85", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17428, "upload_time": "2014-09-10T18:28:52", "url": "https://files.pythonhosted.org/packages/0b/fe/12ddab893b2b9500a1776ec103ad5ea9ebc18bbd652776ba49c1fd8fe9f4/pysolve-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "1a8f7f18e94b02296aac74bc40d308f7", "sha256": "aacadd4f806f097e65b9d9056d1549ae38f6b235d4fa1ec40ffe3dd872244dd9" }, "downloads": -1, "filename": "pysolve-0.1.3.tar.gz", "has_sig": false, "md5_digest": "1a8f7f18e94b02296aac74bc40d308f7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17626, "upload_time": "2014-09-11T17:51:30", "url": "https://files.pythonhosted.org/packages/f7/04/7f174c3e6981e6ce93b3fc82c2021ab3d6f9c70b0a769acf5b4b7efe9aef/pysolve-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "8b55b0673eefdc0946c6f1d397912f17", "sha256": "a99c4b506086c0232799cf337cf2cc863aeb5e5b63ace775be9c5636e4dd7adb" }, "downloads": -1, "filename": "pysolve-0.1.4.tar.gz", "has_sig": false, "md5_digest": "8b55b0673eefdc0946c6f1d397912f17", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17816, "upload_time": "2014-09-17T07:49:21", "url": "https://files.pythonhosted.org/packages/f2/f8/b83c21ad6a69bc9f6d90fb7b3e40c56b3b5a7c355e18df0b23ef93da595e/pysolve-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "444e7e08ee69483a0e4af5ba79a6b37f", "sha256": "e0a6c0873fccb9e5b3beee05db1beb9bf67af0a82abc886937b088c2a103bc71" }, "downloads": -1, "filename": "pysolve-0.1.5.tar.gz", "has_sig": false, "md5_digest": "444e7e08ee69483a0e4af5ba79a6b37f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20304, "upload_time": "2014-09-24T11:26:20", "url": "https://files.pythonhosted.org/packages/32/d9/952623b68cf2367c598995be220a13cb8bf92546e50326f2fe73003c997f/pysolve-0.1.5.tar.gz" } ], "0.1.6": [ { "comment_text": "", "digests": { "md5": "1335fd4b8fbe0bec37063580456213b2", "sha256": "c80ccc119cb11280538b9d715fc35645d7f93eddc3c158153cadbb10fb94db95" }, "downloads": -1, "filename": "pysolve-0.1.6.tar.gz", "has_sig": false, "md5_digest": "1335fd4b8fbe0bec37063580456213b2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21172, "upload_time": "2014-09-25T10:35:40", "url": "https://files.pythonhosted.org/packages/ee/c5/a09174e00d6dde852b878e1eff1abd1c51cb3304c4e7c4e8a1fd6c386fd0/pysolve-0.1.6.tar.gz" } ], "0.1.7": [ { "comment_text": "", "digests": { "md5": "427cee06cf350ead75b17be2c759f6bf", "sha256": "7ba630bec0274df48ee6b9184b08d1f842d2b5484049f7a9b1564b9bcf282fcb" }, "downloads": -1, "filename": "pysolve-0.1.7.tar.gz", "has_sig": false, "md5_digest": "427cee06cf350ead75b17be2c759f6bf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21664, "upload_time": "2014-09-26T19:16:20", "url": "https://files.pythonhosted.org/packages/67/6f/c8de7e02c61a3a9a55a16f40fe31eb5619690cb22bc22727f042adb8e2e7/pysolve-0.1.7.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "427cee06cf350ead75b17be2c759f6bf", "sha256": "7ba630bec0274df48ee6b9184b08d1f842d2b5484049f7a9b1564b9bcf282fcb" }, "downloads": -1, "filename": "pysolve-0.1.7.tar.gz", "has_sig": false, "md5_digest": "427cee06cf350ead75b17be2c759f6bf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21664, "upload_time": "2014-09-26T19:16:20", "url": "https://files.pythonhosted.org/packages/67/6f/c8de7e02c61a3a9a55a16f40fe31eb5619690cb22bc22727f042adb8e2e7/pysolve-0.1.7.tar.gz" } ] }