Saturday, November 19, 2022

Casio fx-9750GIII: Integrals with Infinite Limits

Casio fx-9750GIII:  Integrals with Infinite Limits





A Substitution to Get to Infinity... 


It is quite a challenge to calculate numerical integrals with infinite limits such as 


∫( f(x) dx, a, ∞)


∫( f(x) dx, -∞, a)


∫( f(x) dx, -∞, ∞)



A trick is to substitute x = tan Θ.  Then:


Θ = arctan x


dx = sec^2 Θ dΘ = cos^-2 Θ dΘ



Note that


lim t→∞ arctan t = π/2


lim t→-∞ arctan t = -π/2  


In this blog, assume that radian angle mode is used in all calculations.


Let's go over some examples and see how it works.  I used a Casio fx-9750GIII, however, this technique should work with all calculators with numerical integral calculations.  Furthermore, changing the integral will allow for Simpson's Rule or Trapezoid Rule approximation.


For the upper limit, I approximate π/2.


A = 1.5708  (π/2 to 4 places)

B = 1.570796  (π/2 to 6 places)

C = 1.57079633 (π/2 to 8 places)



Example 1:  


∫( e^(-x^2) dx, 0, ∞)  


transforms to


∫( e^(-tan^2 Θ)/cos^2 Θ dΘ, 0, ≈π/2)


Calculations (fx-9750GIII):


Upper Limit: A (see above),  Result:  0.8862269255


Upper Limit: B,  Result:  0.8862269255


Upper Limit: C,  Result:  0.8862269255




Example 2:  


∫(x^0.5 * e^(-x) dx, 0, ∞)


transforms to


∫((tan Θ)^0.5 * e^(-tan Θ))/cos^2 Θ dΘ, 0, π/2)


Calculations:


Upper limits A, B, C:  0.862269255


Coincidently, ∫( e^(-x^2) dx, 0, ∞)  = ∫(x^0.5 * e^(-x) dx, 0, ∞) = Γ(1.5) = √(π)/2




Example 3:


∫( e^x*(x^2 + 1) dx, -∞, 0)


transforms to


∫( e^(tan Θ) * (tan^2 Θ + 1)/cos^2 Θ dΘ, -π/2, 0)

=  ∫( e^(tan Θ) * 1/cos^2 Θ * 1/cos^2 Θ dΘ, -π/2, 0)

∫( e^(tan Θ)/cos^4 Θ dΘ, -π/2, 0)


For upper limits A, B, C, the answer returned is 3, which is the exact answer.  


For integrals like this all is needed is a four digit approximation of π/2 = 1.5708.



Let's keep going:


Example 4:


∫( (x^2 + 1)/(x^4 - 1) dx, 0, ∞) 


transforms to


∫( 1/cos^Θ * (tan^2 Θ + 1)/(tan^4 Θ - 1) dΘ, 0, π/2)

= ∫( 1/(sin^4 Θ - cos^4 Θ) dΘ, 0, π/2)


On the fx-9750GIII get MA Error.  



Example 5:


∫( 1/√(x^2 + 3*x + 1) dx, 0, ∞)


transforms to 


∫( 1/(cos^2 Θ * √(tan^2 Θ + 3 * tan Θ + 1)) dΘ, 0, π/2)


like example 4, I get the MA Error.



Observation:  the transformation works best if the integral involves some form of either of the following:


f(x) * e^(g(x))


or 


f(x) * e^(-g(x))



Gamma


The Gamma Function is an excellent candidate for this transformation.  


Γ(t) = ∫( x^(t-1) * e^-x dx, 0, ∞)


transforms to


∫( tan^(t-1) Θ * e^(-tan Θ)/cos^2 Θ dΘ, 0, π/2)



Source


Mier-Jedrzejuwicz, W.A.C. Ph.D.    Tips And Programs for the HP 32S   Synthetix Publication.  Berkeley, CA.  September 1988.  ISBN 0-937637-05-X


Download the book here:  https://literature.hpcalc.org/items/1756




Happy calculating,


Eddie


All original content copyright, © 2011-2022.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author. 


HP 20S: Gamma Function Approximation (Stirling's Formula)

HP 20S:  Gamma Function Approximation (Stirling's Formula) Introduction The gamma function uses the approximation sequence: Let t = x + ...