Differential Equation System Solver
Project description
DESolver
This is a python package for solving Initial Value Problems using various numerical integrators. Many integration routines are included ranging from fixed step to symplectic to adaptive integrators.
Implicit integrators are intended for release 3.0, but that's far off for now.
Latest Release
2.5.0 - Event detection has been added to the library. It is now possible to do numerical integration with terminal and non-terminal events.
2.2.0 - PyTorch backend is now implemented. It is now possible to numerically integrate a system of equations that use pytorch tensors and then compute gradients from these.
Use of PyTorch backend requires installation of PyTorch from here.
To Install:
Just type
pip install desolver
Implemented Integration Methods
Adaptive Methods
Explicit Methods
- Runge-Kutta 45 with Cash-Karp Coefficients
- Adaptive Heun-Euler Method
Implicit Methods
NOT YET IMPLEMENTED
Fixed Step Methods
Explicit Methods
- Midpoint Method
- Heun's Method
- Euler's Method
- Euler-Trapezoidal Method
- BABs9o7H Method -- Based on arXiv:1501.04345v2 - BAB's9o7H
- ABAs5o6HA Method -- Based on arXiv:1501.04345v2 - ABAs5o6H
- Runge-Kutta 5 - The 5th order integrator from RK45. Very accurate with fixed step size.
Implicit Methods
NOT YET IMPLEMENTED
Minimal Working Example
This example shows the integration of a harmonic oscillator using DESolver.
import desolver as de
import desolver.backend as D
@de.rhs_prettifier("""[vx, x]""")
def rhs(t, state, **kwargs):
x,vx = state
dx = vx
dvx = -x
return D.array([dx, dvx])
y_init = D.array([1., 0.])
a = de.OdeSystem(rhs, y0=y_init, dense_output=True, t=(0, 2*D.pi), dt=0.01, rtol=1e-6, atol=1e-9)
a.show_system()
a.integrate()
print(a)
print("If the integration was successful and correct, a[0].y and a[-1].y should be near identical.")
print(a[0].y, a[-1].y)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file DESolver-2.5.6.tar.gz.
File metadata
- Download URL: DESolver-2.5.6.tar.gz
- Upload date:
- Size: 26.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2.post20191201 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8447c84f436b0657f5eca455f78599df937cb7e639de42355bd012ab7a7b3b1a
|
|
| MD5 |
cd6849fed4e7d4b4bcdd4999698c6740
|
|
| BLAKE2b-256 |
fe1546448b41e793641bad06c2bf71cbba4d0cb70052d6d15fa5f211478e73e9
|
File details
Details for the file DESolver-2.5.6-py2.py3-none-any.whl.
File metadata
- Download URL: DESolver-2.5.6-py2.py3-none-any.whl
- Upload date:
- Size: 38.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2.post20191201 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97b319f1a2dd8574a37cfe2404668d05aad4ad544be3166ab065a7ecaf7edee6
|
|
| MD5 |
55a2b3c05888f0e607811139258aa2a4
|
|
| BLAKE2b-256 |
36ea7896ed1e10855bb2a4d505f7e0f92200aaf370cb9b9f8b171de01209a192
|