rk4_solver(numer) Numerical Analysis rk4_solver(numer)
NAME
rk4_solver - Object that solves systems of differential
equations using Runge_Kutta method.
DESCRIPTION
This object solves ordinary differential equation using
Runge-Kutta method; independent parameter is time and its
value is assumed to be the start value of the interval of
the solution; dimension is the dimension of the system of
equations; 1/resolution is the time interval for which
solution is sought; number_of_steps is the number of steps
in 1/resolution time period; the solution is generated by
repeatedly calling rk4! method implemented in superclass;
the state of the system is stored in function object after
the solution is found. To find the system trajectory one
has to repeatedly call tick! and store system state in
data object.
SUPERCLASS
rk4_stepper
INSTANCE VARIABLES
time
is the time of the initial state of the system.
resolution
is the number of time points in the unit of time
for which solution is sought.
number_of_steps
is the number of steps of Runge_Kutta method for a
single time interval size 1/resolution.
MESSAGES
number_of_steps=argument
sets the value of number_of_steps.
number_of_steps?
returns the value of number of steps.
resolution=argument
sets the value of resolution.
resolution?
returns the value of resolution.
time=argument
sets the value of time.
time? returns the value of time.
tick! Computes the solution of the system for the time =
time + 1 / resolution.
EXAMPLES
/* This code contains undefined object called system_function, therefore it cannot be executed directly;
you should use your function instead that is defined
object and responds to the messages state= and state? */
system_function new: my_function;
rk4_solver new: asolver
function= my_function
time = 1
resolution = 5
number_of_steps = 4 ;
asolver tick!;
data new: adata dimension=[asolver dimension?];
-- store the first data point
adata time = 1.2 value= [my_function state?];
asolver tick!
-- store the second data point
adata time = 1.4 value= [my_function state?];
-- ...
SEE ALSO
lu_solver, rk4_stepper, rk_shooter, rkqc_stepper,
rkqc_solver.
Please send comments and suggestions toconsult@rpi.edu