Skip to content

Examples Gallery

Visual gallery of Diffid applications and use cases.

Gallery Under Construction

This gallery is being populated with examples. Check the examples directory for current code.

Available Examples

Scalar Optimisation

Rosenbrock Function

Classic 2D optimisation test problem.

Files:

Topics: ScalarBuilder, contour plots, optimiser comparison


ODE Parameter Fitting

Logistic Growth

Single-variable ODE with DiffSL.

File: logistic_growth.py

Topics: DiffsolBuilder, DiffSL syntax, data fitting


Bouncy Ball

Physics-based model with event handling.

Files:

Topics: Event detection, parameter uncertainty, MCMC


Model Comparison

Bicycle Model

Comparing different bicycle dynamics formulations.

Files:

Topics: Model selection, evidence calculation, Bayes factors


Multi-Backend ODE Solving

Predator-Prey Models

Lotka-Volterra equations with multiple solver backends.

Files:

Topics: VectorBuilder, JAX/Diffrax, Julia/DifferentialEquations.jl, performance comparison


Running Examples

Clone the repository:

git clone https://github.com/bradyplanden/diffid.git
cd diffid

Install dependencies:

pip install diffid matplotlib

Run an example:

python examples/python_problem.py

For ODE examples:

python examples/logistic_growth.py

For multi-backend examples (requires additional dependencies):

# For Diffrax (JAX)
pip install jax diffrax

# For DifferentialEquations.jl (Julia)
pip install diffeqpy
# Then follow Julia setup instructions

python examples/predator_prey/predator_prey_diffrax.py

Contributing Examples

Have an interesting use case? We'd love to include it!

  1. Fork the repository
  2. Add your example to examples/
  3. Include a brief comment header explaining the example
  4. Open a pull request

See the Contributing Guide for details.

See Also