大家好,我采用DNEQNF求解非线性方程组,代码如下:
[Fortran] 纯文本查看 复制代码 C module function_equation
C implicit none
C contains
subroutine FCN(xx,yy,nn)
implicit none
integer nn
double precision xx(nn),yy(nn)
yy(1) = xx(1)**2+xx(2)**2-5d0
yy(2) = (xx(1)+1d0)*xx(2)-(3d0*xx(1)+1d0)
return
end subroutine
C end module
program main_test
use imsl
C use function_equation
implicit none
external FCN
double precision , parameter :: errrel = 1d-7
integer , parameter :: n = 2
integer , parameter :: itmax = 200
double precision x_guess,ans(2),fnorm
x_guess = (1d0,1d0)
call dneqnf(FCN,errrel,n,itmax,x_guess,ans,fnorm)
print *, ans
end
如果希望将求解的方程封装在一个module里面,则出现错误。这样的问题应该怎么解决呢?
(上述代码去掉注释后 ,就将求解的函数封装在module里面了。)
|