brainpy.integrators.ode.adaptive_rk.CashKarp#

class brainpy.integrators.ode.adaptive_rk.CashKarp(f, var_type=None, dt=None, name=None, adaptive=None, tol=None, show_code=False, state_delays=None, neutral_delays=None)[source]#

The Cash–Karp method for ODEs.

The Cash–Karp method was proposed by Professor Jeff R. Cash from Imperial College London and Alan H. Karp from IBM Scientific Center. it uses six function evaluations to calculate fourth- and fifth-order accurate solutions. The difference between these solutions is then taken to be the error of the (fourth order) solution. This error estimate is very convenient for adaptive stepsize integration algorithms.

It has the characteristics of:

  • method stage = 6

  • method order = 4

  • Butcher Tables:

\[\begin{split}\begin{array}{l|lllll} 0 & & & & & & \\ 1 / 5 & 1 / 5 & & & & & \\ 3 / 10 & 3 / 40 & 9 / 40 & & & \\ 3 / 5 & 3 / 10 & -9 / 10 & 6 / 5 & & \\ 1 & -11 / 54 & 5 / 2 & -70 / 27 & 35 / 27 & & \\ 7 / 8 & 1631 / 55296 & 175 / 512 & 575 / 13824 & 44275 / 110592 & 253 / 4096 & \\ \hline & 37 / 378 & 0 & 250 / 621 & 125 / 594 & 0 & 512 / 1771 \\ & 2825 / 27648 & 0 & 18575 / 48384 & 13525 / 55296 & 277 / 14336 & 1 / 4 \end{array}\end{split}\]

References

1

https://en.wikipedia.org/wiki/Cash%E2%80%93Karp_method

2

J. R. Cash, A. H. Karp. “A variable order Runge-Kutta method for initial value problems with rapidly varying right-hand sides”, ACM Transactions on Mathematical Software 16: 201-222, 1990. doi:10.1145/79505.79507

__init__(f, var_type=None, dt=None, name=None, adaptive=None, tol=None, show_code=False, state_delays=None, neutral_delays=None)#

Methods

__init__(f[, var_type, dt, name, adaptive, ...])

build()

load_states(filename[, verbose])

Load the model states.

nodes([method, level, include_self])

Collect all children nodes.

register_implicit_nodes(nodes)

register_implicit_vars(variables)

save_states(filename[, variables])

Save the model states.

set_integral(f)

Set the integral function.

train_vars([method, level, include_self])

The shortcut for retrieving all trainable variables.

unique_name([name, type_])

Get the unique name for this object.

vars([method, level, include_self])

Collect all variables in this node and the children nodes.

Attributes

A

B1

B2

C

arg_names

arguments

All arguments when calling the numer integrator of the differential equation.

dt

The numerical integration precision.

integral

The integral function.

name

neutral_delays

neutral delays.

parameters

The parameters defined in the differential equation.

state_delays

State delays.

variables

The variables defined in the differential equation.