| User Documentation |
| Centre for Vision, Speech & Signal Processing |
| DEVELOP | IN NAMESPACE | AMMA TREE ROOT | AMMA SEARCH | AMMA HOME |
| RungeKuttaC<class T> | |
| A fifth order Runge-Kutta scheme, also called Kutta-Merson scheme. | |
| include | "amma/RungeKutta.hh" |
| User Level: | Default |
| Library: | diffeq |
| Example: | ex_kutta.cc |
| Section: | Numerical Methods.Differential Equations |
| In Scope: | std |
Comments:
This scheme is for the integration of a set of first order equations, and
uses a variable stepsize:
starting from a known value (y0), five new values (y1, y2, y3, y4,
y5) are calculated using a halve, a third, a sixth and an eight of
the current stepsize (h) and the gradients at the calculated values.
The difference between the fourth (y4) and the fifth (y5) value is
an estimation of the error in the fifth value (y5) compared tot the
exact value at a distance h from the old value (y0).
This error in y5 is considered too large if (0.2*Abs(y4-y5) > relerr*Abs(y4)) or (0.2*Abs(y4-y5) > abserr) for all elements of y, in which case the stepsize will be halved. On the other hand, if (0.2*Abs(y4-y5) <= 64*relerr*Abs(y4)) or (0.2*Abs(y4-y5) <= 64*abserr) then the error is much smaller than necessary and the stepsize will be doubled. The initial value for the stepsize ('time step') is given by the user and is equal to the initial value for the stepsize h.
The user can also give a maximum integration time or a number of 'time steps' to be taken. When more than one 'timestep' is to be made, the value for the stepsize h at the end of a 'timestep' is used for the next 'time step'.
----------------------------------------------------------------------
Class RungeKuttaC is made as a template of type T. In order to use
this function type T must have:
constuctor, copy constructor, destructor
T operator=(const T& v);
T operator+(const T& v);
T operator-(const T& v);
T operator*(const RealT& d);
void Assign(const T & v);
T Copy(void);
T Abs(void);
BooleanT LargerThan(const T& q, const RealT& threshold)
BooleanT LargerThan(const RealT& val, const RealT& threshold)
BooleanT IsEmpty()
void DisplayVal();
---------------------------------------------------------------------
RungeKuttaC is very similar in form to GNumIntegC, see also the
documentation for it. In particular notes on the internal reference.
Class RungeKuttaC is meant to execute one Runge-Kutta integration step.
One such step consists of several intermediate steps.
-------------------------------------------------------------------------
| Programmer:Dorien vandeBelt, Documentation by CxxDoc: Tue Mar 20 10:48:08 2001 |