Operators > Calculus Operators > Non-Convergence of Numerical Evaluation of Integrals with Infinite Limits
Non-Convergence of Numerical Evaluation of Integrals with Infinite Limits
This topic provides a workaround for two cases of non-convergence errors when numerically evaluating integrals with one or two infinite integration limits.
To explain the two cases, define a mean μ and a standard deviation σ.
Click to copy this expression
Click to copy this expression
Case I: Integral with One Infinite Integration Limit
Set multiplier variable n to 1, and then define function g(x) in terms of the built-in probability density function dnorm.
Click to copy this expression
Click to copy this expression
Click to copy this expression
When n=1, evaluating the integral of g(x) over the range [0, ∞] does not return an error, but returns a very small value.
Workaround for Case I
Increase the value of n to n=2 and re-evaluate the integral.
Click to copy this expression
Click to copy this expression
Click to copy this expression
Increasing the value of n to n=2 results in an error because the calculation is not converging to a solution.
As a workaround, set variable T to a value that is close to the tail of g(x), and then split the single integral into two: one that covers range [0, T] and one that covers range [T, ∞].
Click to copy this expression
Click to copy this expression
Click to copy this expression
Click to copy this expression
The split integral A3 returns a good answer when n=1 or n=2. Plot g(x) and add vertical marker T to see how close it is to the tail of g(x).
Click to copy this expression
The plot shows variable T as the vertical marker close to the tail of g(x).
Case II: Integral with Two Infinite Integration Limits
Set the multiplier variable n to 1, and then evaluate the integral of g(x) over the range [-∞, ∞].
Click to copy this expression
Click to copy this expression
Click to copy this expression
When n=1, evaluating the integral of g(x) over the range [-∞, ∞] returns no error but the returns a very small value.
Workaround for Case II
As a workaround, set variables T1 & T2 to values that are close to the head and tail of g(x), and then split the single integral into three integrals: one to cover range [-∞, T1], one that covers range [T1, T2], and one that covers range [T2, ∞].
Click to copy this expression
Click to copy this expression
Click to copy this expression
Click to copy this expression
Click to copy this expression
Click to copy this expression
Click to copy this expression
Click to copy this expression
The split integral returns a good answer when n=1 or n=2. Plot g(x) and add vertical markers T1 and T2 to see how close they are to the head and tail of g(x).
Click to copy this expression
Observations and Conclusions
Plot the built-in probability density function dnorm using the same mean but two different values of standard deviation.
Click to copy this expression
Click to copy this expression
Click to copy this expression
The plot shows that:
the smaller standard deviation value causes the bulk of the area under the curve to be closer to the mean. In this case, the numerical calculation converges but returns the wrong answer.
the larger standard deviation value causes the bulk of the area under the curve to be spread away from the mean. In this case, the numerical calculation fails to converge.
In both cases, splitting the integral ensures that the calculation converges and returns the correct answer.
Was this helpful?