next up previous contents
Next: ``rk4ind'' Up: Double precision Previous: Double precision

Integration routines

Update your integration routines ``trapint'' and ``simpint'' from HW#1 so that they now function in double precision:

C:        double trapint(double f[],double r[],double dr[],int N)

Fortran:  double precision function trapint(f,r,dr,N)
          integer N
          double precision f(N),r(N),dr(N)

and

C:        double simpint(double f[],double r[],double dr[],int N)

Fortran:  double precision function simpint(f,r,dr,N)
          integer N
          double precision f(N),r(N),dr(N)

Notes: This should involve mostly replacing all occurrences of ``float'' with ``double'' with an editor (if your code is in C) or replacing ``real'' with ``double'' (if your code is in Fortran). Also, if you are coding in Fortran, you must make sure that your numerical constants, like ``2.'' or ``3.'', are in double precision. The best way to do this is to put ``d0'' after them, as in ``2.d0'' and ``3.d0''.



Tomas Arias
Tue Feb 8 16:02:01 EST 2000