``rk4p480()''

Copy (carefully) the numerical recipes routine ``rk4'' from NR 16.1 to a file named ``p480.c'' and modify it to produce a function of the following form:

void rk4p480(double y[], double dydx[], int n, double x, double h, double yout[],
             void (*derivs)(double, double [], double [], 
             int, double [], double [], double [], int),
             int k, int dk, double f[], double r[], double dr[], int N)

Output:

Input:


Notes:

Be certain to modify ``rk4'' to function entirely in double precision. For this, you must not only declare all variables double precision, but also must replace the calls to ``vector()'' and ``free_vector()'' with calls to to ``dvector()'' and ``free_dvector()'', repectively.

To be able to access the input arrays f[], r[], dr[] properly, treat the indices $k$ and $dk$ as integer versions of $x$ and $h$: (1) when ``rk4p480()'' defines $xh=x+hh$ with $hh=h/2$, define $kh=k+dk/2$; (2) whenever ``rk4p480()'' calls ``derivs()'', add five new appropriate arguments to the call (k,f,r,dr,N); (3) make sure that the appropriate value for k (either $k$, $kh$ or $k+dk$) is passed to each call to ``derivs()'', paralleling how rk4p480 treats $x$.

Tomas Arias 2005-02-07