Prev | Next |
# include <cppad/utility/ode_gear.hpp>
OdeGear(F, m, n, T, X, e)
cppad/utility/ode_gear.hpp
is included by cppad/cppad.hpp
but it can also be included separately with out the rest of
the CppAD
routines.
Fun
and the object
F
satisfy the prototype
Fun &F
This must support the following set of calls
F.Ode(t, x, f)
F.Ode_dep(t, x, f_x)
t
has prototype
const Scalar &t
(see description of Scalar
below).
x
has prototype
const Vector &x
and has size
n
(see description of Vector
below).
f
to
F.Ode
has prototype
Vector &f
On input and output,
f
is a vector of size
n
and the input values of the elements of
f
do not matter.
On output,
f
is set equal to @(@
f(t, x)
@)@
(see
f(t, x)
in Purpose
).
f_x
has prototype
Vector &f_x
On input and output,
f_x
is a vector of size @(@
n * n
@)@
and the input values of the elements of
f_x
do not matter.
On output,
@[@
f\_x [i * n + j] = \partial_{x(j)} f_i ( t , x )
@]@
f
, and
f_x
must have a call by reference in their prototypes; i.e.,
do not forget the &
in the prototype for
f
and
f_x
.
m
has prototype
size_t m
It specifies the order (highest power of @(@
t
@)@)
used to represent the function @(@
x(t)
@)@ in the multi-step method.
Upon return from OdeGear
,
the i
-th component of the polynomial is defined by
@[@
p_i ( t_j ) = X[ j * n + i ]
@]@
for @(@
j = 0 , \ldots , m
@)@ (where @(@
0 \leq i < n
@)@).
The value of @(@
m
@)@ must be greater than or equal one.
n
has prototype
size_t n
It specifies the range space dimension of the
vector valued function @(@
x(t)
@)@.
T
has prototype
const Vector &T
and size greater than or equal to @(@
m+1
@)@.
For @(@
j = 0 , \ldots m
@)@, @(@
T[j]
@)@ is the time
corresponding to time corresponding
to a previous point in the multi-step method.
The value @(@
T[m]
@)@ is the time
of the next point in the multi-step method.
The array @(@
T
@)@ must be monotone increasing; i.e.,
@(@
T[j] < T[j+1]
@)@.
Above and below we often use the shorthand @(@
t_j
@)@ for @(@
T[j]
@)@.
X
has the prototype
Vector &X
and size greater than or equal to @(@
(m+1) * n
@)@.
On input to OdeGear
,
for @(@
j = 0 , \ldots , m-1
@)@, and
@(@
i = 0 , \ldots , n-1
@)@
@[@
X[ j * n + i ] = x_i ( t_j )
@]@
Upon return from OdeGear
,
for @(@
i = 0 , \ldots , n-1
@)@
@[@
X[ m * n + i ] \approx x_i ( t_m )
@]@
e
is an approximate error bound for the result; i.e.,
@[@
e[i] \geq | X[ m * n + i ] - x_i ( t_m ) |
@]@
The order of this approximation is one less than the order of
the solution; i.e.,
@[@
e = O ( h^m )
@]@
where @(@
h
@)@ is the maximum of @(@
t_{j+1} - t_j
@)@.
Scalar
must satisfy the conditions
for a NumericType
type.
The routine CheckNumericType
will generate an error message
if this is not the case.
In addition, the following operations must be defined for
Scalar
objects
a
and
b
:
Operation | Description |
a < b
|
less than operator (returns a bool object)
|
Vector
must be a SimpleVector
class with
elements of type Scalar
.
The routine CheckSimpleVector
will generate an error message
if this is not the case.
cppad/ode_gear.hpp
.