https://github.com/microno95/desolver
A Python library for solving Initial Value Problems using various numerical integration methods.
https://github.com/microno95/desolver
initial-value-problem numerical-integrators numerical-methods numpy ode ordinary-differential-equations python pytorch
Last synced: 5 days ago
JSON representation
A Python library for solving Initial Value Problems using various numerical integration methods.
- Host: GitHub
- URL: https://github.com/microno95/desolver
- Owner: Microno95
- License: other
- Created: 2016-01-31T21:25:11.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2025-04-24T22:21:59.000Z (6 months ago)
- Last Synced: 2025-09-25T12:24:10.035Z (18 days ago)
- Topics: initial-value-problem, numerical-integrators, numerical-methods, numpy, ode, ordinary-differential-equations, python, pytorch
- Language: Python
- Homepage:
- Size: 8.93 MB
- Stars: 19
- Watchers: 2
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELOG.rst
- License: LICENSE
Awesome Lists containing this project
README
DESolver
========.. image:: https://github.com/Microno95/desolver/actions/workflows/pytest-ubuntu.yml/badge.svg
:target: https://github.com/Microno95/desolver/actions/workflows/pytest-ubuntu.yml
:alt: Build Status.. image:: https://readthedocs.org/projects/desolver/badge/?version=latest
:target: https://desolver.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status.. image:: https://codecov.io/gh/Microno95/desolver/branch/master/graph/badge.svg
:target: https://codecov.io/gh/Microno95/desolver
:alt: codecovThis 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.
.. code-block:: python
import desolver as de
import desolver.backend as Ddef rhs(t, state, k, m, **kwargs):
return D.array([[0.0, 1.0], [-k/m, 0.0]])@statey_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))))