\(\newcommand{\B}[1]{ {\bf #1} }\) \(\newcommand{\R}[1]{ {\rm #1} }\)
py_an_ode¶
View page sourceUse Python Runge-Kutta Method to Solve an ODE¶
Syntax¶
ode =
cmpad.an_ode( *like_numpy* ) ode .
setup ( option ) yf = ode ( x )
Prototype¶
class an_ode :
def __init__(self, like_numpy) :
self.like_numpy = like_numpy
#
def option(self) :
return self.option
#
def domain(self) :
return self.n_arg
#
def range(self) :
return self.n_arg
#
def setup(self, option) :
assert type(option) == dict
assert type( option['n_arg'] ) == int
assert type( option['n_other'] ) == int
assert option['n_arg'] > 0
assert option['n_other'] > 0
Algorithm¶
This is a python implementation of the an_ode Algorithm .
like_numpy¶
This is a like_numpy class. It is used to vectorize the rk4_step algorithm.
ode¶
The object ode corresponding to fun_obj in the function object interface.
n_arg¶
see n_arg . This is the number of elements that are computed by one like_numpy operation in the r4k_step algorithm
n_other¶
see n_other .
x¶
This is the Parameter Vector that appears in the ODE.
yf¶
The return value yf is \(y(t)\) at \(t = 2\) .
Example¶
xam_an_ode.py contains an example and test of an_ode .
Source Code¶
an_ode.py displays the source code for this algorithm.