Skip to main content

a class to integrate ordinary differential equation

Project description

diffint

Documentation Status

Using diffint, initial value problems can be solved numerically. In the backend, an adaptive numerical integration is performed using CVODES from the SUNDIALS suite.

Given initial state $x(t_0)=x_0$ and control inputs $u(t)$ on $t \in [t_0,t_f]$, the state trajectory $x(t)$ is computed for the explicit differential equation $\dot{x}=f(x,u,t,p)$.

Symbol Description Dimensions
$x(t)$ State vector $\mathbb{R}^{n_x}$
$u(t)$ Control vector $\mathbb{R}^{n_u}$
$p$ Parameter vector $\mathbb{R}^{n_p}$
$t$ time $\mathbb{R}^{1}$

Backend Implementation

The simulatetraj function utilizes a CasADi integrator backend, supporting various numerical methods such as explicit RK4, IRK, and solvers from the CVODES suite. The framework supports symbolic objects, allowing for the construction of symbolic state trajectories that can be embedded into expression graphs for nonlinear optimization within CasADi.

Numerical Transformation and Efficiency

Internally, the differential equation is transformed from the time interval $[t_0, t_f]$ to a normalized domain $[0, 1]$.

$$\dot{x}=f(t,x,u)$$

$$\dot{x}=(t_f-t_0) f(t_0+(t_f-t_0)\tau,x,u)$$

This approach offers significant advantages:

Numerical Conditioning – It improves stability and facilitates parametric studies.

Resource Optimization – Most importantly, it allows the integrator object to be reused within the context of multiple shooting. This eliminates the overhead of repeated object creation, saving valuable computational time.

Dependencies

  • casadi
  • scipy
  • numpy
  • matplotlib

Installation

User

Create a virtual environment and install the package using pip.

python -m venv sim_env
pip install simulatetraj

Run the scripts from examples folder to verify the installation.

Developer

Install poetry and clone the repository.

git clone https://github.com/sandeep026/simulatetraj.git

Install the packages using poetry

poetry install --with docs, dev

Poetry will either use an existing environment or will create a new one.

Examples

Check the docs for examples and usage.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

diffint-0.0.5.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

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

diffint-0.0.5-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file diffint-0.0.5.tar.gz.

File metadata

  • Download URL: diffint-0.0.5.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.4 Windows/10

File hashes

Hashes for diffint-0.0.5.tar.gz
Algorithm Hash digest
SHA256 2ba37bcc805a0d942ea4ef3d663fc07af90e69adf99d81c95085730c5cc9c9ba
MD5 6159d7d888eab3e2faa13fe1c76709fe
BLAKE2b-256 7061b03046d62e40e820aa3d22e9318920fb3052ab2e25edcfd9bfd5ecc8be9c

See more details on using hashes here.

File details

Details for the file diffint-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: diffint-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.4 Windows/10

File hashes

Hashes for diffint-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 93ee410ac90cc9963464f46c4e41718759b18df4d1a1c678267dfd903daf6c77
MD5 f881606d256dff41ff5b47c89f26dc72
BLAKE2b-256 9b8c5342c28d05db433f6bbd69aab953d38a202425bd2a8cf3ad324712c5614d

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