c test of euler method real x,y,dx,x0,y0 real yreal,error pi=3.1415926 x0=0.0 y0=0.0 xlim=1.0 write(6,*) ' dx ?' read(5,*) dx n=xlim/dx nwrite=n/10 i=0 s2=0.0 x=x0 y=y0 10 continue i=i+1 call euler(x,y,dx) yreal=sin(2.0*pi*x) error=y-yreal s2=s2+error**2 write(2,601) x,y,yreal,error if(mod(i,nwrite).eq.0) then write(6,601) x,y,yreal,error endif if(x.gt.xlim) then s2=s2/i s=sqrt(s2) write(6,*) i,s stop endif go to 10 601 format(1h ,4(1pe12.5,2x)) end *********************************************************************** function f(x,y) pi=3.1415926 f=2.0*pi*cos(2.0*3.1415926*x) return end *********************************************************************** c subroutine of euler method of one variable subroutine euler(x,y,dx) real dx,dy,x,y c dy=f(x,y)*dx c x=x+dx y=y+dy return end