Fortran Coder

查看: 11324|回复: 5
打印 上一主题 下一主题

[数学库] 非线性方程组:IMSL neqnf

[复制链接]

8

帖子

1

主题

0

精华

入门

F 币
39 元
贡献
11 点
跳转到指定楼层
楼主
发表于 2018-5-27 22:59:47 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 sit2018 于 2018-5-27 23:20 编辑

编译器:compaq visual fortran 6.6
以下代码出错:

--------------------Configuration: hello - Win32 Debug--------------------
Compiling Fortran...
C:\Program Files\Microsoft Visual Studio\MyProjects\hello\hello.f90
C:\Program Files\Microsoft Visual Studio\MyProjects\hello\hello.f90(33) : Error: This is an actual argument keyword name, and not a dummy argument name.   [XGUESS]
call neqnf(fcn, x, XGUESS=xguess, FNORM=fnorm)
-------------------^
Error executing df.exe.
hello.exe - 1 error(s), 0 warning(s)


program hello
    use imsl
implicit none
integer n
parameter (n = 3)
integer k, nout
real fnorm, x(n), xguess(n)
external fcn
data xguess/4.0, 4.0, 4.0/
call umach (2,nout)
call neqnf(fcn, x, XGUESS=xguess, FNORM=fnorm)
write (nout, 99999) (x(k),k=1,n), fnorm
99999 format (' the solution to the system is', /, ' x = (', 3f5.1, &
')', /, ' with fnorm = ', f5.4, //)

end program hello
subroutine fcn(x,f,n)
integer n
real x(n), f(n)
real exp,sin
intrinsic exp, sin
f(1) = x(1)+exp(x(1)-1.0)+(x(2)+x(3))*(x(2)+x(3)) -27.0
f(2) = exp(x(2)-2.0)/x(1)+x(3)*x(3)-10.0
f(3) = x(3)+sin(x(2)-2.0)+x(2)*x(2)-7.0
return
end subroutine fcn

分享到:  微信微信
收藏收藏 点赞点赞 点踩点踩

8

帖子

1

主题

0

精华

入门

F 币
39 元
贡献
11 点
沙发
 楼主| 发表于 2018-5-27 23:21:29 | 只看该作者
参考一下帖子没有解决:
http://bbs.fcode.cn/forum.php?mo ... &highlight=imsl

796

帖子

2

主题

0

精华

大宗师

F 币
3787 元
贡献
2266 点
板凳
发表于 2018-5-28 10:10:36 | 只看该作者
查一下 neqnf 函数 的说明,参数列表没有XGUESS。

8

帖子

1

主题

0

精华

入门

F 币
39 元
贡献
11 点
地板
 楼主| 发表于 2018-5-30 03:51:16 | 只看该作者
我是按照手册里的例子写的。一模一样。不知道为什么会出错

8

帖子

1

主题

0

精华

入门

F 币
39 元
贡献
11 点
5#
 楼主| 发表于 2018-5-30 04:11:21 | 只看该作者
这个例子可以编译。
http://bbs.fcode.cn/forum.php?mo ... mp;highlight=DNEQNF

program sss

        use imsl

        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

        print *, 'Hello World'

        end program sss

        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

796

帖子

2

主题

0

精华

大宗师

F 币
3787 元
贡献
2266 点
6#
发表于 2018-5-30 19:05:03 | 只看该作者
如果是完全按照手册的话,就是手册和你实际安装的版本不一样。
您需要登录后才可以回帖 登录 | 极速注册

本版积分规则

捐赠本站|Archiver|关于我们 About Us|小黑屋|Fcode ( 京ICP备18005632-2号 )

GMT+8, 2024-4-19 15:03

Powered by Tencent X3.4

© 2013-2024 Tencent

快速回复 返回顶部 返回列表