How to integral 2 time

4 次查看(过去 30 天)
PP STML
PP STML 2017-6-14
I am a vey new Matlab user. Could anyone please help me with this integral? How can I get the result of g?
f(x) = int((6719222573537927*exp((5*x)/2 - (15*u)/2)*(u + x)^(3/2)*(u - x)^19)/576460752303423488, u, abs(x), Inf)
h(x) = exp(-(x-3)^2)
gexpr = abs(f(x)-h(x))*f(x)
gfun = matlabFunction(gexpr)
g = integral(gfun, -inf, inf)

回答(1 个)

Walter Roberson
Walter Roberson 2017-6-14
The expression is simply too complicated for MATLAB to integrate symbolically. There are other software vendors and tools that are more complete. Two of the leading commercial alternatives are Maple (Maplesoft) and Mathematica (Wolfram Research)
  3 个评论
Walter Roberson
Walter Roberson 2017-6-14
The numbers involved in the computation get so large that you are getting catastrophic cancellation that is leaving MATLAB with the impression of very large oscillations fairly close together. Numeric integration cannot cope with oscillations that large and that rapid.
If you were to plot gexpr (the symbolic expression that is to be integrated) then the output you would get would vary greatly depending how many digits you were calculating to. 75 digits of precision is not enough to get anything reasonable for plotting between 34.82 to 34.87 for example, but 200 digits is enough so that the wild swings in the resulting plot over that range are only magnitude +/- 10^(-33) . Unfortunately switching to 200 digits is not enough to save the numeric integral: you are integrating to infinity and the intermediate values just get larger and larger, so you would need infinitely high precision to handle the values as you got towards infinity.
Walter Roberson
Walter Roberson 2017-6-14
I had some success in plotting when I broke f(x) into a piecewise based upon x < 0 or not, with one integrating from x to infinity and the other integrating from -x to infinity, to get the effect of the x as the bound. The two parts separately integrate more simply than the combination -- though one of the two is notably more messy. You can then extend the piecewise to the calculation of gexpr . The resulting expression has a peak at about -3/4, and a much smaller peak around 1, and graphs considerably more readily.
However, the overall result still involves expressions that have terms that vary too quickly for Maple to be willing to try to integrate, even though in practice the values get very small.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Symbolic Math Toolbox 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by