dsolve


Namedsolve JSON
Version 0.0.16 PyPI version JSON
download
home_pagehttps://github.com/marcdelabarrera/dsolve
SummarySolver of dynamic equations with forward looking variables
upload_time2023-04-24 14:32:11
maintainer
docs_urlNone
authorMarc de la Barrera i Bardalet
requires_python
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # dsolve

`dsolve` is a package to solve systems of dynamic equations in Python. 

## Sequence Space

$$F(X,\mathcal{E})=0$$

$$f_t(x_{t-1},x_{t},x_{t+1},\epsilon_t)=0\qquad \forall t$$



## Symbolic
A package to solve systems of dynamic equations with Python. It understands $\LaTeX$ syntax and it requires minimum specifications from the user end. It solves problems of the form:

$$A_0\begin{bmatrix}x_{t+1}\\ E_{t}[p_{t+1}]\end{bmatrix}=A_1\begin{bmatrix}x_{t}\\ p_{t}\end{bmatrix}+\gamma z_t$$

with $x_t$ given. Following Blanchard Kahn notation, $x_{t}$ are state variables (known at time $t$) while $p_{t}$ are forward-looking variables, and $z_t$ are shocks with $E_t[z_{t+1}]=0$. The solver uses the Klein (2000) algorithm which allows for $A_0$ to be invertible. 

Returns the matrix solution


$$p_t=\Theta_p x_t+Nz_t$$
$$x_{t+1}=\Theta_x x_t+Lz_t$$

and methods to plot impulse responses given a sequence of $z_t$

The main class of the package is `Klein`, which stores and solves the dynamic system. It takes a list of strings that are written as $\LaTeX$ equations, a dictionary that define the numeric values of the parameters, and the specification of `x`, `p` and `z`, specified as a list of $\LaTeX$ strings or a long string separated by commas.  

Usage (for more examples check the [notebook tutorial](https://github.com/marcdelabarrera/dsolve/blob/main/notebooks/dsolve_tutorial.ipynb))
```python
from dsolve.solvers import Klein

# Your latex equations here as a list of strings
eq=[
    '\pi_{t}=\beta*E\pi_{t+1}+\kappa*y_{t}+u_{t}',
    'y_{t}=Ey_{t+1}+(1-\phi)*E[\pi_{t+1}]+\epsilon_{t}',
    '\epsilon_{t} = \rho_v*\epsilon_{t-1}+v_{t}'
]

# Your calibration here as a dictionary
calibration = {'\beta':0.98,'\kappa':0.1,'\phi':1.1,'\rho_v':0.8}

# Define pre-determined variables, forward looking variables, and shocks as strings separated by commas or a list of strings.

x = '\epsilon_{t-1}'
p = '\pi_t, y_t'
z = 'v_t, u_t'

system = Klein(eq = eq, x=x, p=p, z=z, calibration=calibration)

# Simulate the inpulse response of a shock v_{0}=0 for 12 periods when \epsilon_{-1}=0

system.simulate(x0=0, z = {'v_{t}':1}, T=12)
```

## Flexible input reading

The standarized way to write a variable is `E_{t}[x_{s}]` to represent the expectation of `x_{s}` at time `t`. but `dsolve` understands other formats. `Ex_{s}`, `E[x_s]` and `Ex_s` are quivalents to  `E_{t}[x_{s}]`, and the subscript `t` is assumed. 

Greek symbols can be writen as `\rho` or just `rho`. 

`dsolve` understands fractions and sums. `\sum_{i=0}^{2}{x_{i,t}}` produces `x_{0,t}+x_{1,t}+x_{2,t}` and fraction `\frac{a}{b}` produces `(a)/(b)`

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/marcdelabarrera/dsolve",
    "name": "dsolve",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Marc de la Barrera i Bardalet",
    "author_email": "mbarrera@mit.edu",
    "download_url": "https://files.pythonhosted.org/packages/fa/74/5b93be8027b5a2ca6b8d259d8e2b52bd671c3a9c05787cffb4a2c38a5723/dsolve-0.0.16.tar.gz",
    "platform": null,
    "description": "# dsolve\n\n`dsolve` is a package to solve systems of dynamic equations in Python. \n\n## Sequence Space\n\n$$F(X,\\mathcal{E})=0$$\n\n$$f_t(x_{t-1},x_{t},x_{t+1},\\epsilon_t)=0\\qquad \\forall t$$\n\n\n\n## Symbolic\nA package to solve systems of dynamic equations with Python. It understands $\\LaTeX$ syntax and it requires minimum specifications from the user end. It solves problems of the form:\n\n$$A_0\\begin{bmatrix}x_{t+1}\\\\ E_{t}[p_{t+1}]\\end{bmatrix}=A_1\\begin{bmatrix}x_{t}\\\\ p_{t}\\end{bmatrix}+\\gamma z_t$$\n\nwith $x_t$ given. Following Blanchard Kahn notation, $x_{t}$ are state variables (known at time $t$) while $p_{t}$ are forward-looking variables, and $z_t$ are shocks with $E_t[z_{t+1}]=0$. The solver uses the Klein (2000) algorithm which allows for $A_0$ to be invertible. \n\nReturns the matrix solution\n\n\n$$p_t=\\Theta_p x_t+Nz_t$$\n$$x_{t+1}=\\Theta_x x_t+Lz_t$$\n\nand methods to plot impulse responses given a sequence of $z_t$\n\nThe main class of the package is `Klein`, which stores and solves the dynamic system. It takes a list of strings that are written as $\\LaTeX$ equations, a dictionary that define the numeric values of the parameters, and the specification of `x`, `p` and `z`, specified as a list of $\\LaTeX$ strings or a long string separated by commas.  \n\nUsage (for more examples check the [notebook tutorial](https://github.com/marcdelabarrera/dsolve/blob/main/notebooks/dsolve_tutorial.ipynb))\n```python\nfrom dsolve.solvers import Klein\n\n# Your latex equations here as a list of strings\neq=[\n    '\\pi_{t}=\\beta*E\\pi_{t+1}+\\kappa*y_{t}+u_{t}',\n    'y_{t}=Ey_{t+1}+(1-\\phi)*E[\\pi_{t+1}]+\\epsilon_{t}',\n    '\\epsilon_{t} = \\rho_v*\\epsilon_{t-1}+v_{t}'\n]\n\n# Your calibration here as a dictionary\ncalibration = {'\\beta':0.98,'\\kappa':0.1,'\\phi':1.1,'\\rho_v':0.8}\n\n# Define pre-determined variables, forward looking variables, and shocks as strings separated by commas or a list of strings.\n\nx = '\\epsilon_{t-1}'\np = '\\pi_t, y_t'\nz = 'v_t, u_t'\n\nsystem = Klein(eq = eq, x=x, p=p, z=z, calibration=calibration)\n\n# Simulate the inpulse response of a shock v_{0}=0 for 12 periods when \\epsilon_{-1}=0\n\nsystem.simulate(x0=0, z = {'v_{t}':1}, T=12)\n```\n\n## Flexible input reading\n\nThe standarized way to write a variable is `E_{t}[x_{s}]` to represent the expectation of `x_{s}` at time `t`. but `dsolve` understands other formats. `Ex_{s}`, `E[x_s]` and `Ex_s` are quivalents to  `E_{t}[x_{s}]`, and the subscript `t` is assumed. \n\nGreek symbols can be writen as `\\rho` or just `rho`. \n\n`dsolve` understands fractions and sums. `\\sum_{i=0}^{2}{x_{i,t}}` produces `x_{0,t}+x_{1,t}+x_{2,t}` and fraction `\\frac{a}{b}` produces `(a)/(b)`\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Solver of dynamic equations with forward looking variables",
    "version": "0.0.16",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1d4f8987486cc7f4581b54f58595f93a3039ddf76dfa48e097bca89764ef4462",
                "md5": "e575cadc79b3f3f86f35489119fbb4e2",
                "sha256": "48d840e1fd88b6167d2341c8e0395c89ea28fca5a4c3d7b523495b925c01d114"
            },
            "downloads": -1,
            "filename": "dsolve-0.0.16-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e575cadc79b3f3f86f35489119fbb4e2",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 16485,
            "upload_time": "2023-04-24T14:32:09",
            "upload_time_iso_8601": "2023-04-24T14:32:09.618046Z",
            "url": "https://files.pythonhosted.org/packages/1d/4f/8987486cc7f4581b54f58595f93a3039ddf76dfa48e097bca89764ef4462/dsolve-0.0.16-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fa745b93be8027b5a2ca6b8d259d8e2b52bd671c3a9c05787cffb4a2c38a5723",
                "md5": "4d5ebf8c5fb10739a988c3ec07bcaad7",
                "sha256": "81b7593bfdc805df84ae8cf7a00963bf79ef355cb0a74da3f41d38f0f19dab7c"
            },
            "downloads": -1,
            "filename": "dsolve-0.0.16.tar.gz",
            "has_sig": false,
            "md5_digest": "4d5ebf8c5fb10739a988c3ec07bcaad7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 99077,
            "upload_time": "2023-04-24T14:32:11",
            "upload_time_iso_8601": "2023-04-24T14:32:11.670134Z",
            "url": "https://files.pythonhosted.org/packages/fa/74/5b93be8027b5a2ca6b8d259d8e2b52bd671c3a9c05787cffb4a2c38a5723/dsolve-0.0.16.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-24 14:32:11",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "marcdelabarrera",
    "github_project": "dsolve",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "dsolve"
}
        
Elapsed time: 0.05674s