Euler’s Method | FORTRAN 95

Fortran Programming - Bottom Science

Fortran Code

PROGRAM euler_method
IMPLICIT NONE
REAL::x0=0,y0=-1,x,x1,y1,f,h

x1=x0
y1=y0

PRINT *,'====================================================' 
PRINT *,"Program for Euler’s method [www.BottomScience.com]"
PRINT *,'===================================================='

PRINT *,'Step size (h)?'
READ(*,*)h

PRINT *,'value?'
READ(*,*)x

DO WHILE (x1<x)
  y1=y1+(h*f(x1,y1))
  x1=x1+h
  PRINT *,x1,y1
END DO

END PROGRAM

Leave a Reply

Your email address will not be published.