如何在 scilab 中求从 limit-infinity 到 +infinity 的积分
如何在SCILAB中求从-无穷大到+无穷大的积分? (要积分的表达式不能直接积分)
How to find integrals from limits -infinity to +infinity in SCILAB ? ( Expression to be integrated are not directly integratable )
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将积分变量从 x=(-inf,inf) 更改为 z=atan(x)
x=tan(z),
dx/dz = 1/(cos(z))^2
在新变量 z 中,积分限制从 -%pi/2+eps 到 +%pi/2-eps,其中 eps 是一个非常小的正数 (否则你将无法除以 cos(z)) 和
积分 f(x) dx =
= 积分 f(x(z)) d(x(z))
= 积分 f(z) dx/dz dz
例如,
函数 y=高斯(x); y=exp(-x^2/2)/sqrt(2*%pi);结束函数;
intg(-10,10,Gaussian)
与
获得相同的积分结果
函数 y=Gmodified(z); x=tan(z); y=高斯(x)/(cos(z))^2;结束函数;
intg(atan(-10),atan(10),Gmodified)
有趣的是,Scilab 即使对于
也会采用上述积分
intg(-%pi/2,%pi/2,G修改)
但这只是因为 Scilab 将 1/cos(%pi/2) 计算为 1.633D+16 而不是无穷大。
Change the variable of integration from x=(-inf,inf) to z=atan(x)
x=tan(z),
dx/dz = 1/(cos(z))^2
In the new variable z, the integration limits are from -%pi/2+eps to +%pi/2-eps, where eps is a very small positive number (else you will not be able to divide by the cos(z)) and
integral f(x) dx =
= integral f(x(z)) d(x(z))
= integral f(z) dx/dz dz
For example,
function y=Gaussian(x); y=exp(-x^2/2)/sqrt(2*%pi); endfunction;
intg(-10,10,Gaussian)
The same integration result is achieved with
function y=Gmodified(z); x=tan(z); y=Gaussian(x)/(cos(z))^2; endfunction;
intg(atan(-10),atan(10),Gmodified)
Interestingly, Scilab will take the above integral even for
intg(-%pi/2,%pi/2,Gmodified)
but this is only because Scilab evaluates 1/cos(%pi/2) as 1.633D+16 rather than infinity.