LibCapy - rungekutta

RungeKutta implementation.

Macros:

Enumerations:

None.

Typedefs:

None.

Struct CapyRungeKutta :

Struct CapyRungeKutta's properties:

Derivative function F(). For first order: F(t, X) = X' For second order: F(t, X, X') = X''

Order of the deriviative (<3), used to interpret the shape of X in the derivative function

Number of variables (automatically set based on derivation.nbInput and order)

Initial values [t0, X0] (default: all 0)

Temporary vectors for calculation

Discretise step delta t (default: 1e-3)

Struct CapyRungeKutta's methods:

Approximate X(t) using RK4

Input argument(s):

t: value for which we want to approximate X(t)
vals: values [t0, X(t0)] or [t0, X(t0), X'(t0)]

Output and side effect(s):

Update 'vals' with the approximated values at 't'

Run one step

Input argument(s):

vals: current values [t0, X(t0)] or [t0, X(t0), X'(t0)]

Output and side effect(s):

'vals' is updated with the result of one step of RK4

Destructor

Functions:

Create a CapyRungeKutta

Input argument(s):

derivative: the derivative function
order: maximum derivative order of the derivative (must be <3)

Output and side effect(s):

Return a CapyRungeKutta

Allocate memory for a new CapyRungeKutta and create it

Input argument(s):

derivative: the derivative function

Output and side effect(s):

Return a CapyRungeKutta

Exception(s):

May raise CapyExc_MallocFailed.

Free the memory used by a CapyRungeKutta* and reset '*that' to NULL

Input argument(s):

that: a pointer to the CapyRungeKutta to free

2025-03-30
in LibCapy,
0 views
Copyright 2021-2025 Baillehache Pascal