      program rktest
C
C  test of 4th order Runge-Kutta on simple harmonic motion
C
C  CWJ SDSU April 2005
C
      implicit none

      real x,t
      real dt

      real p
 
      real Nsteps
      real n
 
      print*,' Enter starting x,dx/dt '
      read*,x,p
      
      print*,' enter dt, # of steps '
      read*,dt,nsteps

      t = 0.

      do n = 1,Nsteps
          call rungekutta2(dt,t,x,p)
          write(6,101)t,x
          write(17,101)t,x
  101 format(2f10.5)
       enddo
       end 


CCCCCCCCCCCCCCCCCCCCC

      real function f(x,p,t)
      implicit none

      real x,p,t
      
      f=p
 
      return
      end

CCCCCCCCCCCCCCCCCCCCC

      real function g(x,p,t)
      implicit none

      real x,p,t
 
      g = -x

      return
      end
