Skip to main content

Differential Equation System Solver

Project description

DESolver

BCH compliance

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.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. Requires installation of PyTorch from here. Torch backend will not work without pytorch!

To Install:

Just type

pip install desolver

Implemented Integration Methods

Adaptive Methods

Explicit Methods

  1. Runge-Kutta 45 with Cash-Karp Coefficients
  2. Adaptive Heun-Euler Method

Implicit Methods

NOT YET IMPLEMENTED

Fixed Step Methods

Explicit Methods

  1. Midpoint Method
  2. Heun's Method
  3. Euler's Method
  4. Euler-Trapezoidal Method
  5. BABs9o7H Method -- Based on arXiv:1501.04345v2 - BAB's9o7H
  6. ABAs5o6HA Method -- Based on arXiv:1501.04345v2 - ABAs5o6H
  7. 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

DESolver-2.4.1.tar.gz (22.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

DESolver-2.4.1-py2.py3-none-any.whl (47.3 kB view details)

Uploaded Python 2Python 3

File details

Details for the file DESolver-2.4.1.tar.gz.

File metadata

  • Download URL: DESolver-2.4.1.tar.gz
  • Upload date:
  • Size: 22.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for DESolver-2.4.1.tar.gz
Algorithm Hash digest
SHA256 f2812c1b8b2a22386e5fbc1ef6cf2a11977a097a830997216b16ab905115cb2a
MD5 373c638ae071d85b188b60f4c7cc4bd1
BLAKE2b-256 cc1c20427490d26071dfca93b8150617786c25b279c58fa099646ecbe0bb774e

See more details on using hashes here.

File details

Details for the file DESolver-2.4.1-py2.py3-none-any.whl.

File metadata

  • Download URL: DESolver-2.4.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 47.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for DESolver-2.4.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 9fd83bde8f2a97bb19390996c59cbbb2e2f9aa12fe3d50001a3bfc7829f7dc6c
MD5 cd3ce6b86d954aad7d9d0a4832f8fc75
BLAKE2b-256 dbc59735efdf3f793006864d856832c9f43fcd407846d6b38d9af31c84e80e04

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page