# rigid_body_ode

rigid_body_ode, an Octave code which solves the ordinary differential equations (ODE) representing the Euler equations for a rigid body with three unequal moments of inertia, originally proposed by Fred Krogh.

A rectangular object can rotate stably about its longest or shortest axis, but not the intermediate one. We let x(t), y(t), and z(t) be the angular momenta, and I1, I2, I3 the moments of inertia about the three principal axes.

The ODE can be written:

```        x' = a y z
y' = b x z
z' = c x y
```
where:
```        a = 1/I3 - 1/I2
b = 1/I1 - 1/I3
c = 1/I2 - 1/I1
```

Example choices include (I1,I2,I3) = (1,1/2,1/3) and (I1,I2,I3) = (1/6,1,2/3).

### Languages:

rigid_body_ode is available in a MATLAB version and an Octave version and a Python version.

### Related Data and codes:

arenstorf_ode, an Octave code which describes an ordinary differential equation (ODE) which defines a stable periodic orbit of a spacecraft around the Earth and the Moon.

axon_ode, an Octave code which sets up the ordinary differential equations (ODE) for the Hodgkin-Huxley model of an axon.

biochemical_linear_ode, an Octave code which defines a linear biochemical ordinary differential equation (ODE).

biochemical_nonlinear_ode, an Octave code which defines a nonlinear biochemical ordinary differential equation (ODE).

blowup_ode, an Octave code which considers an ordinary differential equation (ODE) y'=y^2. whose solution "blows up" in finite time.

brusselator_ode, an Octave code which defines the Brusselator ordinary differential equation (ODE) system.

conservation_ode, an Octave code which monitors the conservation of a quantity that should be constant, during the solution of an ordinary differential equation (ODE).

dosage_ode, an Octave code which uses a system of ordinary differential equations (ODE) to simulate the blood levels of a medicinal drug that should stay between medicinal and toxic limits.

duffing_ode, an Octave code which considers a second-order ordinary differential equation (ODE) whose solution can exhibit chaotic behavior.

exp_ode, an Octave code which sets up an ordinary differential equation (ODE) whose solution is an exponential function.

fitzhugh_nagumo_ode, an Octave code which solves the Fitzhugh-Nagumo system of ordinary differential equations (ODE).

flame_ode, an Octave code which considers an ordinary differential equation (ODE) which models the growth of a ball of flame in a combustion process.

grazing_ode, an Octave code which solves a pair of ordinary differential equations (ODE) that model the populations of an edible plant, and the herbivore that grazes on it.

henon_heiles_ode, an Octave code which solves the Henon-Heiles system of ordinary differential equations (ODE) which model the motion of a star around the galactic center.

humps_ode, an Octave code which solves an ordinary differential equation (ODE) whose solution is a double hump curve.

kepler_ode, an Octave code which defines the ordinary differential equations (ODE) for a Kepler two body gravitational problem.

kepler_perturbed_ode, an Octave code which defines the ordinary differential equations (ODE) for a perturbed Kepler two body gravitational problem.

lorenz_ode, an Octave code which approximates solutions to the Lorenz system of ordinary differential equations (ODE), which exhibit sensitive dependence on the initial conditions.

normal_ode, an Octave code which sets up an ordinary differential equation (ODE) for the normal probability density function (PDF).

oregonator_ode, an Octave code which sets up the ordinary differential equations (ODE) that define the Oregonator, a model of the Belousov-Zhabotinsky chemical reaction.

oscillator_ode, an Octave code which defines the highly oscillatory ordinary differential equation (ODE).

ozone_ode, an Octave code which defines a stiff system of four ordinary differential equations (ODE) that simulate the daily variation in atmospheric ozone concentration.

ozone2_ode, an Octave code which defines a stiff system of four ordinary differential equations (ODE) that simulate the daily variation in atmospheric ozone concentration. This version of the ozone ODE includes a nitrogen oxide source term.

pendulum_double_ode, an Octave code which defines the double pendulum ordinary differential equation (ODE).

pendulum_elastic_ode an Octave code which sets up the ordinary differential equations (ODE) that represent the behavior of a nonlinear elastic pendulum, with gravitational force G, spring constant K, unstretched length L, and mass M.

pendulum_nonlinear_ode, an Octave code which sets up the ordinary differential equations (ODE) that represent a nonlinear model ofthe behavior of a pendulum of length L under a gravitational force of strength G.

pendulum_ode, an Octave code which sets up the ordinary differential equations (ODE) that represent a linear model ofthe behavior of a pendulum of length L under a gravitational force of strength G.

polar_ode, an Octave code which considers an ordinary differential equation (ODE) whose variable is complex, and whose solution should be viewed in a polar coordinate plot.

predator_prey_ode, an Octave code which solves a pair of predator prey ordinary differential equations (ODE).

quadex_ode, an Octave code which solves a stiff ordinary differential equation (ODE), whose exact solution is a parabola, but for which errors grow exponentially.

quasiperiodic_ode, an Octave code which sets up a system of ordinary differential equations (ODE) for a problem with a quasiperiodic solution.

reaction_ode, an Octave code which defines the ordinary differential equations (ODE) which model a simple chemical reaction A+B --k--> C.

reaction_twoway_ode, an Octave code which defines the ordinary differential equations (ODE) which model a two-way chemical reaction between species W1 and W2.

ripple_ode an Octave code which solves an ordinary differential equation (ODE) whose family of solutions start as ripples and end as hyperbolas.

robertson_ode, an Octave code which sets up a system of three nonlinear stiff ordinary differential equations (ODE) characterizing an autocatalytic chemical reaction.

roessler_ode, an Octave code which sets up and solves the Roessler ordinary differential equations (ODE) which exhibit chaotic behavior.

rubber_band_ode, an Octave code which defines and solves a set of ordinary differential equations (ODE) describing a mass suspended by a spring and rubber band, which can exhibit chaotic behavior.

sawtooth_ode, an Octave code which defines an ordinary differential equation (ODE) driven by a right hand side which is a sawtooth function (periodic, discontinuous, piecewise linear).

sir_ode, an Octave code which sets up the ordinary differential equations (ODE) which simulate the spread of a disease using the Susceptible/Infected/Recovered (SIR) model.

spring_ode, an Octave code which sets up a system of ordinary differential equations (ODE) for the motion of a spring with mass m, damping b, and stiffness k.

spring_double_ode, an Octave code which sets up a system of ordinary differential equations (ODE) for a system in which a mass is connected by a spring to a mass connected by a spring to a fixed support.

spring_sweep_ode, an Octave code which computes a grid of solutions to a parameterized system of ordinary differential equations (ODE) that represent the motion of a spring with mass m, damping b, and stiffness k.

squircle_ode, an Octave code which sets up a system of ordinary differential equations (ODE) for a pair of functions that generalize the sine and cosine, and whose phase portrait is a squircle (a sort of squared circle).

stetter_ode, an Octave code which defines an ordinary differential equation (ODE) for which a specific time step sequence causes the implicit trapezoid rule to be unstable, while the implicit midpoint rule will be stable. Note that the right hand side function f(t,y) is periodic, discontinuous, and piecewise linear.

stiff_ode, an Octave code which considers an ordinary differential equation (ODE) which is an example of a stiff ODE.

three_body_ode, an Octave code which defines a set of ordinary differential equations (ODE) which simulates the behavior of three planets, constrained to lie in a plane, and moving under the influence of gravity, by Walter Gander and Jiri Hrebicek.

tough_ode, an Octave code which sets up a system of four ordinary differential equations (ODE) which is extremely difficult to solve accurately.

two_body_ode, an Octave code which defines ordinary differential equations (ODE) which simulate the behavior of two bodies, constrained to lie in a plane, moving under the influence of gravity, with one body much more massive than the other.

vanderpol_ode, an Octave code which defines the right hand side of the van der Pol oscillator ordinary differential equation (ODE).

zombie_ode, an Octave code which sets up a system of ordinary differential equations (ODE) for a generalized SIR infection model to simulate a zombie attack, developed by Philip Munz.

### References:

1. Ernst Hairer,
Solving differential equations on manifolds,
Universite de Geneve,
June 2011.
2. Ernst Hairer, Christian Lubich, Gerhard Wanner,
Geometric numerical integration,
Springer, 2006.
3. Cleve Moler,
Tumbling Box ODE,
https://blogs.mathworks.com/cleve/2015/08/10/tumbling-box-ode/
4. Lawrence Shampine, Marilyn Gordon,
Computer Solution of Ordinary Differential Equations: The Initial Value Problem,
Freeman, 1975,
ISBN: 0716704617,
LC: QA372.S416.
5. Gilbert Strang,
Differential equations and linear algebra,
Wellesley-Cambridge Press, 2015, ISBN13: 9780980232790.

### Source Code:

Last revised on 04 May 2021.