Program

c	Runge Kutta for first order differential equations
c
 	PROGRAM Euler
 	IMPLICIT none
c
c 		declarations
c nsteps:number of steps, tstep:length of steps, y: initial position
c
	REAL*8 t, y, tstep
	INTEGER	j, nsteps
	nsteps=10
        tstep=0.5
        y=1.0
c
c          	open file
        OPEN(6, FILE='eulerf.dat')
        WRITE (6,*) 0, y
c
c 		do loop nsteps of Euler algorithm
	DO 60 j = 1, nsteps
	t=j*tstep
   	y=y-tstep*y
        WRITE (6,*) t, y
 60	CONTINUE
c
	CLOSE(6)
	STOP
        END

A source code which you can save and run on your computer.
Back to main document.