向后欧拉法
01-21
program main
implicit none
integer :: k=10
integer :: n
real :: x,h,y,y1,f
real :: y0=1.00
real :: a=0.00
real :: b=1.00
real, parameter::e=0.0000001 h=(b-a)/k
do n=0,k-1
x=a + n*h
y1=y0 + h*(y0-2*x/y0) x=x + h
y=y0 + h*(y1-2*x/y1) if(abs(y-y1)>=e) then y1=y
y=y0 + h*(y1-2*x/y1) end if
y0=y
write(*,*) x,y
end do
end
0.1000000 1.090864 0.2000000 1.174343 0.3000000 1.251677
0.4000000 1.323707 0.5000000 1.391011 0.6000000 1.453965 0.7000000 1.512789 0.8000000 1.567570 0.9000000 1.618263 1.000000 1.664696 Press any key to continue