linqus 发表于 2005-9-21 09:43

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

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>
页: [1]
查看完整版本: imsl库中数值计算subroutine中function的问题。