我希望集成一个我正在构建的函数,但该函数将根据给定的输入更改每次迭代。例如:
y=4e^(mx/4)我想对x积分,有一个上下界,但是m的值会改变。我知道m的所有值。
我能用这个工作吗?我最初的设想是使用QROMB,但这似乎是有限的,无法处理我的问题。
发布于 2016-07-08 23:38:48
QROMB (和其他积分器)想要一个单变量的函数,所以你必须通过后门把m放进去。一种方法是使用公共块:
function integrand,x
common int_common,int_m
return,4*exp(int_m*x/4)
end
function integrator,m,xlow,xhigh
common int_common,int_m
int_m=m
return,qromb('integrand',xlow,xhigh)
endintegrator(m,xlow,xhigh)将返回您想要的整数。
https://stackoverflow.com/questions/38060152
复制相似问题