第三章 边值问题和本征值问题
3.1numerov算法
例题
program main
implicit none
integer(8)::i,n
real(8)::x(600),y(600),a,h,pi
h=0.01
n=500
pi=3.14159263
open(unit=100,file="xable.csv")
open(unit=101,file="yable.csv")
do i=1,n+1,1
x(i)=(i-1)*h
write(100,*)x(i)
end do
close(100)
y(1)=1
write(101,*)y(1)
y(2)=1-2*pi*pi*h*h
write(101,*)y(2)
a=(3-5*pi*pi*h*h)/(3+pi*pi*h*h)
do i=2,n,1
y(i+1)=2*a*y(i)-y(i-1)
write(101,*)y(i+1)
end do
close(101)
end program
绘制图像如下: