声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 3537|回复: 0

[Fortran] imsl库中数值计算subroutine中function的问题。

[复制链接]
发表于 2005-9-21 09:43 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
fortran的imsl库中有很多数值计算subroutine,<BR>比如数值积分公式:<BR>QDAG/DQDAG (Single/Double precision)<BR>    Integrate a function using a globally adaptive scheme based on Gauss-Kronrod rules.<BR><BR>Usage<BR>CALL QDAG (F, A, B, ERRABS, ERRREL, IRULE, RESULT, ERREST)<BR><BR>Arguments<BR>F — User-supplied FUNCTION to be integrated. The form is F(X), where<BR>X - Independent variable. (Input)<BR>F - The function value. (Output)<BR>F must be declared EXTERNAL in the calling program.<BR>A — Lower limit of integration. (Input)<BR>B — Upper limit of integration. (Input)<BR>ERRABS — Absolute accuracy desired. (Input)<BR>ERRREL — Relative accuracy desired. (Input)<BR>IRULE — Choice of quadrature rule. (Input)<BR>The Gauss-Kronrod rule is used with the following points:<BR>IRULE Points<BR>1 7-15<BR>2 10-21<BR>3 15-31<BR>4 20-41<BR>5 25-51<BR>6 30-61<BR>IRULE = 2 is recommended for most functions. If the function has a peak<BR>singularity, use IRULE = 1. If the function is oscillatory, use IRULE = 6.<BR>RESULT — Estimate of the integral from A to B of F. (Output)<BR>ERREST — Estimate of the absolute value of the error. (Output)<BR><BR>问题是:<BR>其中的F — User-supplied FUNCTION to be integrated. The form is F(X), where<BR>X - Independent variable. (Input)<BR><BR>假如函数F(x)中有大量的参变量,那么编制F(x)函数时,显然不能通过将这些参变量通过参数来传递,因为imsl中F(x)规定为固定格式。<BR>同时,也不能用subroutine来代替Function。<BR>那么,似乎只能用共享变量或用module来封装。<BR>个人以为没有更好的办法了。<BR><BR>精于fortran编程的大侠对此有何看法?<BR>谢谢。<BR>
回复
分享到:

使用道具 举报

您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-11-17 23:29 , Processed in 0.057518 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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