# RK5Integrator#

class gala.integrate.RK5Integrator(func, func_args=(), func_units=None, progress=False, store_all=True)[source]#

Bases: `Integrator`

Initialize a 5th order Runge-Kutta integrator given a function for computing derivatives with respect to the independent variables. The function should, at minimum, take the independent variable as the first argument, and the coordinates as a single vector as the second argument. For notation and variable names, we assume this independent variable is time, t, and the coordinate vector is named x, though it could contain a mixture of coordinates and momenta for solving Hamilton’s equations, for example.

Parameters
func`func`

A callable object that computes the phase-space coordinate derivatives with respect to the independent variable at a point in phase space.

func_args`tuple` (optional)

Any extra arguments for the function.

func_units`UnitSystem` (optional)

If using units, this is the unit system assumed by the integrand function.

Methods Summary

 `run`(w0[, mmap]) Run the integrator starting from the specified phase-space position. `step`(t, w, dt) Step forward the vector w by the given timestep.

Methods Documentation

run(w0, mmap=None, **time_spec)[source]#

Run the integrator starting from the specified phase-space position. The initial conditions `w0` should be a `PhaseSpacePosition` instance.

There are a few combinations of keyword arguments accepted for specifying the timestepping. For example, you can specify a fixed timestep (`dt`) and a number of steps (`n_steps`), or an array of times:

```dt, n_steps[, t1] : (numeric, int[, numeric])
A fixed timestep dt and a number of steps to run for.
dt, t1, t2 : (numeric, numeric, numeric)
A fixed timestep dt, an initial time, and a final time.
t : array-like
An array of times to solve on.
```
Parameters
w0`PhaseSpacePosition`

Initial conditions.

**time_spec

Timestep information passed to `parse_time_specification`.

Returns
orbit`Orbit`
step(t, w, dt)[source]#

Step forward the vector w by the given timestep.

Parameters
dt`numeric`

The timestep to move forward.