Skip to content

Examples on how to integrate ODE systems with Python and how to plot trajectories in phase space.

License

Notifications You must be signed in to change notification settings

benmaier/phase_space_example

Repository files navigation

How to: Integrate ODEs and plot trajectories in phase space

This is a small collection of Python scripts which illustrate how to integrate ODEs in Python and how to plot trajectories in phase space.

Access

Either clone this repository as

git clone git@github.com:benmaier/phase_space_example.git 

or download a zip-file.

Content

As an illustration example, you could begin with a simple pendulum. In 01_ode_example_pendulum.py, I illustrated how to write down the equations of motion as a function and then integrated it to obtain a limit cycle in phase space.

pendulum-single-run

In 02_scan_pendulum.py I added a few lines of code to illustrate how one would scan different initial conditions and parameters to see how the trajectories change.

pendulum-scan

In 03_ode_example_lotka_volterra.py, I show how to integrate a Lotka-Volterra system and how to plot both the time evolution as well as the phase space trajectory.

lotka-volterra

lotka-volterra-2

Finally, in 04_ode_example_lorenz.py, I replicated the figures from Dave's lecture for the Lorenz system. Playing around with this system is the most fun because it shows chaotic behavior.

lorenz

About

Examples on how to integrate ODE systems with Python and how to plot trajectories in phase space.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages