Skip to main content

DESolver

Build Status Documentation Status codecov

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.

Documentation

Documentation is now available at desolver docs! This will be updated with new examples as they are written.

To Install:

Just type

pip install desolver

Use of PyTorch backend requires installation of PyTorch from here.

Minimal Working Example

This example shows the integration of a harmonic oscillator using DESolver.

import desolver as de
import desolver.backend as D

def rhs(t, state, k, m, **kwargs):
    return D.array([[0.0, 1.0], [-k/m,  0.0]])@state

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-9, atol=1e-9, constants=dict(k=1.0, m=1.0))

print(a)

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  = {}".format(a[0].y))
print("a[-1].y = {}".format(a[-1].y))

print("Maximum difference from initial state after one oscillation cycle: {}".format(D.max(D.abs(a[0].y-a[-1].y))))

Implemented Integration Methods

Explicit Methods

Adaptive Methods

  1. Runge-Kutta 14(12) (Feagin, 2009)

  2. Runge-Kutta 10(8) (Feagin, 2009)

  3. Runge-Kutta 8(7) (Dormand & Prince, 1980)

  4. Runge-Kutta 4(5) with Cash-Karp Coefficients

  5. Adaptive Heun-Euler Method

Fixed Step Methods

  1. Symplectic BABs9o7H Method (Mads & Nielsen, 2015, BAB’s9o7H)

  2. Symplectic ABAs5o6HA Method (Mads & Nielsen, 2015, ABAs5o6H)

  3. Runge-Kutta 5 - The 5th order integrator from RK45 with Cash-Karp Coefficients.

  4. Runge-Kutta 4 - The classic RK4 integrator

  5. Midpoint Method

  6. Heun’s Method

  7. Euler’s Method

  8. Euler-Trapezoidal Method

Implicit Methods

Adaptive Methods

  1. Lobatto IIIC 4(2) (Kroulíková, 2017)

  2. Radau IIA 5(2) (Kroulíková, 2017)

Fixed Step Methods

  1. Backward Euler

  2. Implicit Midpoint

  3. Crank-Nicolson

  4. Lobatto IIIA 2

  5. Lobatto IIIB 2

  6. Lobatto IIIC 2

  7. Radau IA 3

  8. Radau IIA 3

  9. Lobatto IIIA 4

  10. Lobatto IIIB 4

  11. Gauss-Legendre 4

  12. Radau IA 5

  13. Radau IIA 6

References

Feagin, T. (2009). High-Order Explicit Runge-Kutta Methods. Retrieved from https://sce.uhcl.edu/rungekutta/

Dormand, J. R. and Prince, P. J. (1980) A family of embedded Runge-Kutta formulae. Journal of Computational and Applied Mathematics, 6(1), 19-26. https://doi.org/10.1016/0771-050X(80)90013-3

Mads, K. and Nielsen, E. (2015). Efficient fourth order symplectic integrators for near-harmonic separable Hamiltonian systems. Retrieved from https://arxiv.org/abs/1501.04345

Kroulíková, T. (2017). RUNGE-KUTTA METHODS (Master’s thesis, BRNO UNIVERSITY OF TECHNOLOGY, Brno, Czechia). Retrieved from https://www.vutbr.cz/www_base/zav_prace_soubor_verejne.php?file_id=174714

Changelog

Version 5.0.0

  • Fully ported backend to use autoray instead of manual specification of each backend, this enables a more portable setup

  • Fully removed pyaudi as a backend

Version 4.5.0

  • Updated to pyproject.toml setup and removed pyaudi support.

  • Added changelog to repository

  • Moved to pyproject.toml and hatch build system

  • Updated github workflow to use hatch

  • Reconfigured tests to have skip flags and have tests enabled by default

Version 4.2.0

  • Improved performance of implicit methods, added embedded implicit methods following Kroulíková (2017) for fully implicit adaptive integration.

Version 4.1.0

  • Initial release of implicit integration schemes that use a basic newton-raphson algorithm to solve for the intermediate states.

Version 3.0.0

  • PyAudi support has been finalised. It is now possible to do numerical integrations using gdual variables such as gdual_double, gdual_vdouble and gdual_real128 (only on select platforms, refer to pyaudi docs for more information). Install desolver with pyaudi support using pip install desolver[pyaudi]. Documentation has also been added and is available at desolver docs.

Version 2.5.0

  • Event detection has been added to the module. It is now possible to do numerical integration with terminal and non-terminal events.

Version 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.

Metadata

Release files for desolver 5.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for desolver 5.1.0
File Size Uploaded
desolver-5.1.0.tar.gz 72.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for desolver 5.1.0
File Interpreter ABI Platform
desolver-5.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 151.3 kB

Release files / desolver-5.1.0.tar.gz

Download URL desolver-5.1.0.tar.gz
Size 72.8 kB
Tags Source
SHA-256 checksum
How to use checksums
14122739c4b2c47180d44cc3d184f6b60c580660a3dddd096eeaa83b31f7a816
BLAKE2b-256 checksum
How to use checksums
8cb3e238c1e9bd9a8a0156ce7753b708071b3e13248df8872a8120a1c466728e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 16, 2025.

Transparency log

Release files / desolver-5.1.0-py3-none-any.whl

Download URL desolver-5.1.0-py3-none-any.whl
Size 78.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
74aca16b815aa9335aa10c77ba434fcca33abdf025f0bc70a7e51e807f277688
BLAKE2b-256 checksum
How to use checksums
575e4f6cd82e821fa7dcbefaae89251257be6505969be21421ca4aa1ceb5cec0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 16, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

5.1.0 This release

2 release files

5.0.0

2 release files

4.4.1

2 release files

4.4.0

2 release files

4.3.1

2 release files

4.3.0

2 release files

4.2.0

2 release files

4.1.3

2 release files

4.1.1

2 release files

4.1.0

2 release files

3.1.5

2 release files

3.1.4

2 release files

3.1.1

2 release files

3.1.0

2 release files

3.0.2

2 release files

3.0.1

2 release files

3.0.0

2 release files

2.5.9

2 release files

2.5.8

2 release files

2.5.7

2 release files

2.5.6

2 release files

2.5.5

2 release files

2.5.4

2 release files

2.5.3

2 release files

2.5.2

2 release files

2.5.0

2 release files

2.4.2

2 release files

2.4.1

2 release files

2.4.0

2 release files

2.3.1

2 release files

2.3.0

2 release files

2.2.5

2 release files

2.2.4

2 release files

2.2.3

2 release files

2.2.2

2 release files

2.2.1

2 release files

2.1.6

2 release files

2.1.5

2 release files

2.1.4

1 release file

2.1.3

1 release file

2.1.2

1 release file

2.1.1

1 release file

2.1.0

1 release file

2.0.2

1 release file

2.0.1

1 release file

2.0.0

1 release file

1.6.0

2 release files

1.5.2

2 release files

1.5.1

2 release files

1.4.5

1 release file

1.4.4

1 release file

1.4.3

2 release files

1.4.2

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

1 release file

1.1.41

1 release file

1.1.40

1 release file

1.1.38

1 release file

1.1.37

1 release file

1.1.36

1 release file

1.1.35

1 release file

1.1.34

1 release file

1.1.33

1 release file

1.1.32

1 release file

1.1.31

1 release file

1.1.30

1 release file

1.1.29

1 release file

1.1.28

1 release file

1.1.26

1 release file

1.1.25

1 release file

1.1.24

1 release file

1.1.23

1 release file

1.1.21

1 release file

1.1.20

1 release file

1.1.19

1 release file

1.1.18

1 release file

1.1.17

1 release file

1.1.16

1 release file

1.1.15

1 release file

1.1.14

1 release file

1.1.13

1 release file

1.1.12

1 release file

1.1.11

1 release file

1.1.10

1 release file

1.1.9

1 release file

1.1.7

1 release file

1.1.6

1 release file

1.1.5

1 release file

1.1.4

1 release file

1.1.3

1 release file

1.1.1

1.1.0

1 release file

1.0.12

1 release file

1.0.11

1 release file

1.0.10

1 release file

1.0.8

1 release file

1.0.7

1.0.6

1.0.5

1.0.4

1.0.3

1.0.2

1.0.1

1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page