Skip to main content

A dynamical systems simulation library.

Project description

dynlib

Dynlib is a Python library for modeling, simulating, and analyzing dynamical systems.
Models are described in a TOML-based DSL (Domain-Specific Language) and then executed through a unified runtime—so you can iterate on solvers, parameters, and analyses without rewriting the same Numpy/Matplotlib plumbing for every experiment.

With dynlib, you can define or tweak a model, try different solvers/settings, and visualize behavior quickly. It can be used with notebooks for teaching and demonstration purposes. Created models can be kept in an organized manner and can be shared easily.

Project status

Dynlib is alpha-stage software. APIs may change, and numerical edge cases or bugs can surface. Treat results as exploratory unless you validate them (e.g., alternative steppers, tighter tolerances, smaller step sizes, or analytical checks). If you find suspicious behavior, please open an issue with a minimal reproducer.

Highlights

Modeling (TOML DSL)

  • Define ODEs and discrete-time maps using a declarative TOML spec.
  • Express equations, parameters, state initialization, and metadata in a consistent format.
  • Support for events, auxiliary variables, functions/macros, and lagging where applicable.
  • Built-in model registry and URI loading (including builtin://... models).

Simulation runtime

  • Multiple stepper families:
    • ODE: Euler, RK4, RK45, Adams–Bashforth (AB2/AB3), and implicit methods (e.g., SDIRK/TR-BDF2).
    • Maps: dedicated discrete runner(s) including integer-safe modes.
  • Runner variants and session introspection utilities for iterative workflows.
  • JIT acceleration via Numba (optional but highly recommended), plus disk caching for compiled runners.
  • Snapshots and resume support for long or staged simulations.
  • Selective recording and result APIs designed for downstream analysis.

Analysis

Built-in analysis utilities for common dynamical-systems tasks:

  • Bifurcation and post-processing utilities
  • Basins of attraction (auto/known variants)
  • Lyapunov exponent analysis (including runtime observer support)
  • Fixed point / Equilibria detection
  • Manifold tracing tools (currently limited to 1D manifolds)
  • Homoclinic/Heteroclinic orbit tracing and detection
  • Parameter sweep helpers and trajectory/post-analysis utilities

Vector fields & plotting (on top of Matplotlib)

Dynlib includes plotting helpers tailored for dynamical systems rather than raw Matplotlib boilerplate:

  • Vector field evaluation utilities and phase-portrait helpers
  • Plot modules for basins, bifurcation diagrams, manifolds, and general dynamics
  • Higher-level plotting conveniences: themes, facets, decorations, and export helpers
  • Vector field animation support

CLI

Dynlib ships a small CLI (Command Line Interface) for convenience tasks such as model validation, listing steppers, and inspecting caches.
The CLI is not required for the Python API.

Prerequisites

  • Python 3.11+
  • Matplotlib for plots.
  • Numpy for numerical calculations.
  • Numba is highly recommended for JIT execution:
    • python -m pip install numba

Installation

  • python -m pip install dynlib or
  • python -m pip install -e . for editable installs from source

Quickstart

Sanity-check the CLI and validate a bundled model:

dynlib --version
dynlib model validate builtin://ode/lorenz.toml

Run a built-in model from Python (Lorenz system):

from dynlib import setup
from dynlib.plot import fig, series, export

sim = setup("builtin://ode/lorenz.toml", stepper="rk4")

sim.run(T=15.0, dt=0.01)
res = sim.results()

print("States:", res.state_names)
print("Final z:", res["z"][-1])

ax = fig.single()
series.plot(x=res.t, y=res["x"], ax=ax, label="x")
series.plot(x=res.t, y=res["z"], ax=ax, label="z", xlabel="time")
export.show()

Next: see the docs for defining your own TOML models, URI tags (proj://...), recording options, and analysis workflows (basins, bifurcation, Lyapunov, fixed points).

Documentation

Check this link for the project documentation: Documentation

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

dynlib-0.38.0.tar.gz (330.8 kB view details)

Uploaded Source

Built Distribution

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

dynlib-0.38.0-py3-none-any.whl (377.6 kB view details)

Uploaded Python 3

File details

Details for the file dynlib-0.38.0.tar.gz.

File metadata

  • Download URL: dynlib-0.38.0.tar.gz
  • Upload date:
  • Size: 330.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for dynlib-0.38.0.tar.gz
Algorithm Hash digest
SHA256 754ce2cff7dba8586f01cca07e45b965c4e7f93e5becd0640a236a47b1340ce0
MD5 e11dc65d0e6da9900fef247b87e4a956
BLAKE2b-256 70851af08b4ce329c23bbf45f50d3bddc363e6c3449198d77a00c33ac971f526

See more details on using hashes here.

File details

Details for the file dynlib-0.38.0-py3-none-any.whl.

File metadata

  • Download URL: dynlib-0.38.0-py3-none-any.whl
  • Upload date:
  • Size: 377.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for dynlib-0.38.0-py3-none-any.whl
Algorithm Hash digest
SHA256 59a90c8e24e2a61c97bf4f94bf81245bff06db446f9c61e3e0ab8d3b5beea293
MD5 c76770bf3e6c8f99613bc63c38732b41
BLAKE2b-256 f97b3625aed4a59315dbfd3c86a9bf7c14742020d6f5998936e187e72a94ebd2

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