Poincare
import numpy as np from poincare import * class LotkaVolterra(System): prey: Variable = initial(default=10) predator: Variable = initial(default=1) prey_eq = prey.derive() << prey * (1 - predator) predator_eq = predator.derive() << predator * (prey - 1) sim = Simulator(LotkaVolterra) sim.solve(save_at=np.linspace(0, 100, 1000)).to_dataframe().plot()
Lokta-Volterra predator-prey model implemented in Poincare.
Poincare is a python library for declaring and simulating dynamical systems. It's designed around:
- Modularity: poincare creates a layer to separate the actual declaration and simulation of models, allowing to easily switch between methods and compile to different backends (including NumPy, Numba and JAX).
- Composability: models are composable, allowing for the combination of smaller systems to create larger ones; complex models can be broken up into more manageable parts.
- Reproducibility: it intends to be a centralized place for all information concerning models, making it easy to extract data (equations, parameters, etc...) and encouraging consistency between analytical formulations and numerical implementations.
- Utility: poincare includes a number of utilities to make model analysis more convenient, including searching for steady states, bistability or limit cycles across a range of parameter values.
Installation
It can be installed from PyPI:
or conda-forge:
Documentation
Documentation is structured as a series of interactive marimo notebooks which cover basic and advanced topics. They can be ran in the browser either in a static or interactive version or by cloning the dyscolab-tutorials repository to open them locally.
Basics
- Getting started with Poincare: the essentials necessary to simulate models. Interactive / Static
- Composition: how to combine smaller models to create more complex ones, one of Poincare's key features. Interactive / Static
- Simulators: more on how configure the simulation, including switching methods and backends. Interactive / Static
Topic guides
- Asymptotic behaviour and parameter sweeps: characterize the asymptotic behaviour of the system, including the search for steady states, bistability and limit cycles, across a range of parameter values. Interactive / Static
GitHub
Poincare is developed in it's github repo.