4#include "KVRungeKutta.h"
44 :
KVBase(
"RK4NR",
"Runge-Kutta ODE integrator with adaptive step-size control"),
45 nvar(
N), eps(PREC),
hmin(MINSTEP)
63 dc1 =
c1 - 2825.0 / 27648.0;
64 dc3 =
c3 - 18575.0 / 48384.0;
65 dc4 =
c4 - 13525.0 / 55296.0;
116 for (
int i = 0; i <
nvar; i++)
y[i] = ystart[i];
118 for (
int nstp = 1; nstp <= MAXSTP; nstp++) {
132 Error(
"Integrate",
"integration stopped at x=%g",
x);
138 if ((
x -
x2) * (
x2 -
x1) >= 0.0) {
139 for (
int i = 0; i <
nvar; i++) ystart[i] =
y[i];
144 Error(
"Integrate",
"Step size %g too small",
hnext);
145 Error(
"Integrate",
"integration stopped at x=%g",
x);
150 Error(
"Integrate",
"Too many steps");
151 Error(
"Integrate",
"integration stopped at x=%g",
x);
183 if (errmax <= 1.0)
break;
188 Error(
"rkqs",
"stepsize underflow");
196 for (
int i = 0; i <
nvar; i++)
y[i] =
yout[i];
216 for (
int i = 0; i <
nvar; i++)
219 for (
int i = 0; i <
nvar; i++)
222 for (
int i = 0; i <
nvar; i++)
225 for (
int i = 0; i <
nvar; i++)
228 for (
int i = 0; i <
nvar; i++)
231 for (
int i = 0; i <
nvar; i++)
233 for (
int i = 0; i <
nvar; i++)
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t hmin
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Base class for KaliVeda framework.
Adaptive step-size 4th order Runge-Kutta ODE integrator from Numerical Recipes.
virtual void rkck(Double_t h)
Int_t nvar
number of independent variables/equations
virtual void CalcDerivs(Double_t X, Double_t *Y, Double_t *DYDX)=0
Double_t eps
precision required
virtual void rkqs(Double_t htry)
Double_t hmin
minimum allowed step size
Int_t nbad
number of bad steps taken
virtual ~KVRungeKutta()
Destructor.
virtual void Integrate(Double_t *ystart, Double_t x1, Double_t x2, Double_t h1)
Int_t nok
number of good steps taken
virtual void Error(const char *method, const char *msgfmt,...) const
Double_t Min(Double_t a, Double_t b)
Double_t Sign(Double_t a, Double_t b)
Double_t Power(Double_t x, Double_t y)
Double_t Max(Double_t a, Double_t b)