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)
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)
Metadata
Release files for dsolve 0.0.17
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dsolve-0.0.17.tar.gz | 99.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dsolve-0.0.17-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 115.7 kB
Release files / dsolve-0.0.17.tar.gz
| Download URL | dsolve-0.0.17.tar.gz |
|---|---|
| Size | 99.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b595ac32ce4b3197f6d325fa22745d8beb22666801f8bed59212ffe5ca43161c
|
|
BLAKE2b-256 checksum How to use checksums |
b7cb8e723d00ebbe059fb8a45a2b0474bb4d580a90feb66af4258d36fbc285a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.6
|
Release files / dsolve-0.0.17-py3-none-any.whl
| Download URL | dsolve-0.0.17-py3-none-any.whl |
|---|---|
| Size | 16.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
eb7a5c5c048868523ac335d67fa6dd261ae1b97d617a9429d7e32d226838ef49
|
|
BLAKE2b-256 checksum How to use checksums |
2f9831367f2ed6b44d924cd3e4b8c544e0427d45776feaf04da804462b01fe56
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.6
|