{"id":21048209,"url":"https://github.com/nicholasjng/ode-explorer","last_synced_at":"2025-12-14T00:58:21.925Z","repository":{"id":57447850,"uuid":"287913089","full_name":"nicholasjng/ode-explorer","owner":"nicholasjng","description":"A small Python library for fast ODE prototyping and visualization.","archived":false,"fork":false,"pushed_at":"2021-04-18T19:30:55.000Z","size":317,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-08T12:19:43.846Z","etag":null,"topics":["hamiltonian-systems","mathematics","numerical-analysis","numerical-methods","numerical-simulations","ode-explorer","odes","ordinary-differential-equations","scientific-computing"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nicholasjng.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-08-16T09:32:03.000Z","updated_at":"2023-08-13T14:06:39.000Z","dependencies_parsed_at":"2022-09-16T22:21:33.286Z","dependency_job_id":null,"html_url":"https://github.com/nicholasjng/ode-explorer","commit_stats":null,"previous_names":["njunge94/ode-explorer"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicholasjng%2Fode-explorer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicholasjng%2Fode-explorer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicholasjng%2Fode-explorer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicholasjng%2Fode-explorer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nicholasjng","download_url":"https://codeload.github.com/nicholasjng/ode-explorer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225370275,"owners_count":17463720,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hamiltonian-systems","mathematics","numerical-analysis","numerical-methods","numerical-simulations","ode-explorer","odes","ordinary-differential-equations","scientific-computing"],"created_at":"2024-11-19T14:42:35.770Z","updated_at":"2025-12-14T00:58:21.873Z","avatar_url":"https://github.com/nicholasjng.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ode-explorer\n\n\u003cdiv align=\"center\"\u003e\n  \n[![PyPI - License](https://img.shields.io/pypi/l/ode-explorer?color=red)](https://pypi.org/project/ode-explorer/)\n[![PyPI](https://img.shields.io/pypi/v/ode-explorer?color=blue)](https://pypi.org/project/ode-explorer/)\n[![Downloads](https://static.pepy.tech/personalized-badge/ode-explorer?period=total\u0026units=international_system\u0026left_color=black\u0026right_color=yellow\u0026left_text=Downloads)](https://pepy.tech/project/ode-explorer)\n  \n\u003c/div\u003e\n\nThis is the ode-explorer Python package,\na small library designed for solving, fast prototyping and visualization\nof systems of ordinary differential equations (ODEs).\n\n\n# Installation\n\nThis project is listed on PyPI, the Python Package Index. To obtain it via PyPI, run\n```\npip install ode-explorer\n```\n\nIt is very much advised to do this inside of a virtual environment to avoid bloating your \nsystem's own Python installation. A popular option for working with virtual environments is \n[virtualenvwrapper](https://virtualenvwrapper.readthedocs.io/en/latest/).\n\n\n# Quickstart with Examples\n\nFor a very quick introduction to the main functionalities of this package, check out the ``ode_explorer.examples`` folder. More examples will be gradually added - if you have a suggestion, or you want to contribute your own, feel free to send me a message!\n\nSome of the examples require a Jupyter installation. To install Jupyter Notebook or Jupyter Lab, run the following inside your created virtual environment:\n```\npip install notebook    ## \u003c---- for Jupyter Notebook\npip install jupyterlab  ## \u003c---- for Jupyter Lab\n```\nIt may also be required to install matplotlib for visualization, which can be done by running ``pip install matplotlib``.\n\n\n# Introduction and main functionalities\n\n## Models\n\nMany processes in nature like radioactive decay, chemical reactions or classical mechanics can be characterized by **ordinary differential equations (ODEs).** Solving these equations for a process then directly gives a prediction of its evolution.\n\nThe number of equations that actually have closed form solutions available is actually a small minority; hence, numerical methods need to be developed to simulate more complex processes with correspondingly complex equations.\n\nAn ordinary differential equation is usually written in literature as\n```\ny' = f(t, y),\n```\n\nwhere ``f(t,y)`` is called the *model*. Based on that intuition, ode-explorer exposes the ``ODEModel`` class, which is a small wrapper around a standard Python callable with signature\n\n```\nf(t: float, y: float or np.ndarray, **kwargs)\n```\nwhere you can add special parameters for your model like reaction constants, decay rates etc. via Python's kwargs paradigm.\n\n## Integrators and step functions\n\nSolving ordinary differential equations in the computer happens by numerical integration. A popular method of solving ODEs are the *single-step methods*, which also encompass Runge-Kutta methods among others.\n\node-explorer handles numerical integration by exposing an *Integrator* object. It has some internal state that facilitates logging among other things, and exposes two main integration APIs, ``integrate_const`` and ``integrate_adaptively``. The former can be used to integrate an ODE using a fixed step size h, while the latter can be equipped with a step size controlling mechanism, which chooses a step size based on local error estimates. For more information, check out the [textbook by Hairer, Wanner and Nørsett](https://www.springer.com/de/book/9783540566700).\n\n**Step functions** are used to advance models in time during numerical integration. These methods usually differ in computational complexity and order of consistency; as a rule of thumb, a more accurate solution requires more computational work (as one might expect).\n\node-explorer provides a ``StepFunction`` Interface that is built exactly for this purpose. Adding your own step functions is very simple - it requires only one of the following:\n1. Subclass the ``StepFunction`` base class and override its ``forward`` method to calculate the estimate.\n2. Initialize one of the template classes in ``ode_explorer.stepfunctions.templates`` with your chosen arguments.\n\nSince most step functions originate from families of methods (e.g. explicit/implicit RK methods, linear multi-step methods), they can be templated rather well - templates for some of the most common step function families are given in ``ode_explorer.stepfunctions.templates``. \n\n\n## Callbacks and metrics\n\nThe main design emphasis of this library is that you can heavily customize your experiments to your liking. Two of the main instruments for this are callbacks and metrics.\n\n*Callbacks* are designed to hook into the control flow of the numerical integration; ode-explorer exposes a ``Callback`` interface which is basically a callable with state. This concept may be familiar to users of ML libraries of scikit-learn and Tensorflow, which were the main inspiration behind this. You can do many things with callbacks, like logging, broadcasting your solver's intermittent results via websocket, check for NaN values - this is where your creativity comes in!\n\nThe same applies to *metrics* (with the corresponding ``Metric`` interface), which are also callables that can be used to compute quantities of interest after each step. Possible use cases include distance to a known ODE solution for sanity checking a step function, logging accepted and rejected steps in a step size control setting, or tracking of a first integral in a Hamiltonian system - again, the possibilities are really vast, so try it out!\n\n## Step size control\n\nStep size control is something like an art form - you can use the built-in ``StepSizeController`` interface to build your own. \n\n# Testing\n\nTesting is still a work in progress, but will be added gradually.\n\n# Planned features for upcoming releases\n\nSome more feature plans that are in the mix for this library:\n\n* Visualizations, Dashboard\n* GPU support using JAX / XLA\n* More builtin callbacks / metrics\n* Boundary value problems (BVPs)\n* Differential-Algebraic Equations (DAEs)\n* Run caching / re-use, warm starting\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicholasjng%2Fode-explorer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnicholasjng%2Fode-explorer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicholasjng%2Fode-explorer/lists"}