|
Prev | Next |
# include <cppad/speed/ode_evaluate.hpp>
ode_evaluate(x, m, fm)
f : \R^n \rightarrow \R^n
defined by
\[
f(x) = y(x, 1)
\]
where
y(x, t)
solves the ordinary differential equation
\[
\begin{array}{rcl}
y(x, 0) & = & b(x)
\\
\partial_t y ( x , t ) & = & g[ x , y(x,t) , t ]
\end{array}
\]
where
b : \R^n \rightarrow \R^n
and
g : \R^n \times \R^n \times \R \rightarrow \R^n
are not any further specified.
A numerical method is used to solve the ode and obtain an accurate
approximation for
y(x, 1)
.
This in turn is used to compute values and Jacobian of the
function
f(x)
.
ode_evaluate
is defined in the CppAD namespace by including
the file cppad/speed/ode_evaluate.hpp
(relative to the CppAD distribution directory).
It is only intended for example and testing purposes,
so it is not automatically included by
cppad.hpp
.
Float
must be a NumericType
.
The
Float
operation sequence for this routine
will depend on the value of the argument
x
and hence it must be retaped for each new value of
x
.
x
has prototype
const CppAD::vector<Float> &x
It contains he argument value for which the function,
or its derivative, is being evaluated.
The value
n
is determined by the size of the vector
x
.
size_t m
It is either zero or one and
specifies the order of the derivative of
f(x)
,
with respect to
x
,
that is being evaluated.
f(x)
is evaluated as described above.
\[
\begin{array}{rcl}
y(x, 0) & = & b(x)
\\
\partial_t y ( x , t ) & = & g[ x , y(x,t) , t ]
\\
y_x (x, 0) & = & b^{(1)} (x)
\\
partial_t y_x (x, t) & = & \partial_x g[ x , y(x,t) , t ]
+ \partial_y g[ x , y(x,t) , t ] y_x
\end{array}
\]
CppAD::vector<Float> &fm
The input value of the elements of
fm
does not matter.
m
is zero, fm has size equal to
n
and contains the value of
y(x, 1)
.
m
is one, fm has size equal to n^2
and for
i = 0 , \ldots and n-1
,
j = 0 , \ldots , n-1
\[
\D{y[i]}{x[j]} (x, 1) = fm [ i \cdot n + j ]
\]
ode_evaluate.hpp.
It returns true if it succeeds and false otherwise.