Fortran Coder

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

[非线性] DNEQNF 算法求解非线性方程组

[复制链接]

712

帖子

4

主题

0

精华

大师

农村外出务工人员

F 币
607 元
贡献
311 点

新人勋章爱心勋章水王勋章元老勋章热心勋章

楼主
发表于 2015-3-19 17:22:57 | 显示全部楼层
错误提示很重要,为什么每次都不给出?

712

帖子

4

主题

0

精华

大师

农村外出务工人员

F 币
607 元
贡献
311 点

新人勋章爱心勋章水王勋章元老勋章热心勋章

沙发
发表于 2015-3-20 13:21:20 | 显示全部楼层
用 Module 封装,你得调用 F90 接口,F77接口不行
[Fortran] 纯文本查看 复制代码
Module function_equation
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)
  End Subroutine fcn
End Module function_equation

Program main_test
  Use neqnf_int
  Use umach_int
  Use function_equation
  Implicit None
  Double Precision, Parameter :: errrel = 1D-7
  Integer, Parameter :: n = 2
  Integer, Parameter :: itmax = 200
  Double Precision x_guess(2), ans(2), fnorm
  x_guess = (1D0, 1D0)
  Call neqnf(fcn, ans, xguess=x_guess, fnorm=fnorm)
  Print *, ans
End Program main_test


您需要登录后才可以回帖 登录 | 极速注册

本版积分规则

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

GMT+8, 2024-5-15 09:13

Powered by Tencent X3.4

© 2013-2024 Tencent

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