主题:求助imsl问题
菜鸟一名 用的是ivf 11.1 编译器是intel vs2008 不自带imsl 自己装了个imsl 该设置的都设置好了,并且找了几个代码试运行了下,有的成功运行了,有的失败了。求高人帮分析下失败的那个。
运行成功的:
program main
INCLUDE 'link_fnl_shared.h'
use numerical_libraries
use lin_sol_gen_int
implicit none
real :: A(3,3) = (/ 1,3,2,1,2,1,2,1,3 /)
real :: B(3,1) = (/ 4,6,6 /)
real :: X(3,1)
call lin_sol_gen(A,B,X) ! A*X=B,解X
write(*,"(3F5.2)") X
stop
end program
失败的,求高人指点:
! IMSL IVPRK范例
! 求解Y'(t)=-0.01*Y(t)
! initial condition Y(0)=2
program main
include 'link_f90_dll.h'
use IMSL_libraries
implicit none
integer, parameter :: MXPARM = 50
integer, parameter :: N = 1
integer IDO, ISTEP, NOUT
real PARAM(MXPARM), T, TEND, Y(N)
real, parameter :: TOL = 1E-3
external FCN
PARAM = 0
WRITE (*,"(' Time', 9X,'Y')")
Y(1) = 2.0 ! Initial condition
T = 0.0 ! Y(T)=2.0中的时间T值
IDO = 1
do ISTEP=0,100,10
TEND = ISTEP
call IVPRK (IDO, N, FCN, T, TEND, TOL, PARAM, Y)
write (*,'(F5.1,F12.4)') T, Y
end do
call IVPRK (3, N, FCN, T, TEND, TOL, PARAM, Y)
stop
end program
! 计算微分方程式
! YPRIME=Y'=f(t,y)
subroutine FCN (N, T, Y, YPRIME)
implicit none
integer N
real T, Y(N), YPRIME(N)
real, parameter :: K=-1E-2
! Y' = K*Y
YPRIME(1) = K*Y(1)
return
end subroutine