Showing posts with label improper integrals. Show all posts
Showing posts with label improper integrals. Show all posts

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. 


Saturday, January 5, 2019

Solar Scientific Calculators: Dealing with Integrals with Infinite Limits

Solar Scientific Calculators:  Dealing with Integrals with Infinite Limits

Integrals with Infinite Limits

Today's post deals with integrals with infinite limits in the forms:

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

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

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

One method to deal with these integrals, as suggested by W.A.C. Mier-Jedrzejowicz Ph. D. (see the source), is to use the substitution

x = tan θ

Then:

dx = dθ/cos^2 θ

and θ = atan x.

Also, as x approaches π/2, tan x approaches +∞.

And, as x approaches -π/2, tan x approaches -∞.

With the substations, let's test four integrals on four solar-powered scientific calculators:

1.  Casio fx-991EX Classwiz
2.  Sharp EL-W516T
3.  Texas Instruments TI-36X Pro
4.  Casio fx-115ES Plus

Set the calculator to radians mode. 




Example 1:  ∫(1/x^2 dx, x = 1 to x = ∞) = 1

∫(1/x^2 dx, x = 1 to x = ∞)

with the substitutions x = tan θ and dx = dθ/(cos^2 θ):

∫( 1/tan^2 θ * dθ/cos^2 θ, θ = atan 1 to θ = π/2)

∫( 1/sin^2 θ * dθ, θ = atan 1 to θ = π/2)

We can evaulate the integral straight away.  Here are the results:

1.  Casio fx-991EX Classwiz
Time: 1.37 seconds
Answer: 1

2.  Sharp EL-W516T
Time: 38 seconds
Answer: 1

3.  Texas Instruments TI-36X Pro
Time: 4.5 seconds
Answer: 1

4.  Casio fx-115ES Plus
Time: 4.2 seconds
Answer: 1

A promising start.

Example 2:  ∫(e^(-0.5*x^2), x = 0 to x = ∞) ≈ 1.25331413732

∫(e^(-0.5*x^2), x = 0 to x = ∞)

with the substituions, this becomes:

∫(e^(-0.5 * tan^2 θ)/cos^2 θ dθ, θ = atan 0 to θ = π/2)

atan 0 = 0

But look at the denominator, we have cos^2 θ.  Since cos^2 π/2 = 0, there will be a problem.  Let's use an approximation of π/2 of 1.5708.

∫(e^(-0.5 * tan^2 θ)/cos^2 θ dθ, θ = 0 to θ = 1.5708)

Here are the results:

1.  Casio fx-991EX Classwiz
Time: 15.4 seconds
Answer: 1.253314137

2.  Sharp EL-W516T
Time: 1 minute, 8 seconds
Answer: errors out

3.  Texas Instruments TI-36X Pro
Time: 36 seconds
Answer: 1.253314138

4.  Casio fx-115ES Plus
Time: 1 minute, 6.8 seconds
Answer: 1.253314137

Example 3:  ∫(x^2*e^-x dx, x = 0 to x = ∞) = 2

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

with the substitutions and simplification, we get:

∫( (sin^2 θ * e^(-tan θ))/cos^4 θ dθ, θ = 0 to θ = π/2)

Like the last situation, there is a potential problem with the denominator.  Let's see if we can use an approximation of π/2, this time using 1.57 in hopes to cut the calculation time down.

∫( (sin^2 θ * e^(-tan θ))/cos^4 θ dθ, θ = 0 to θ = 1.57)

Here are the results:

1.  Casio fx-991EX Classwiz
Time: 27 seconds
Answer: 2

2.  Sharp EL-W516T
Time: 1 minute, 34 seconds
Answer: 1.999999999

3.  Texas Instruments TI-36X Pro
Time: 1 minute, 9 seconds
Answer: 2

4.  Casio fx-115ES Plus
Time: 1 minute, 6.8 seconds
Answer: 1.253314137

Example 4:  ∫( e^-x/x^2 dx, x = 1 to x = ∞) ≈ 0.148495506776

∫( e^-x/x^2 dx, x = 1 to x = ∞)

with the substitutions and simplification, we get:

∫( e^(-tan θ)/sin^2 θ dθ, θ = 0 to θ = π/2)

I'm going to use the 1.57 approximation again and set the integral as:

∫( e^(-tan θ)/sin^2 θ dθ, θ = 0 to θ = 1.57)

Here are the results:

1.  Casio fx-991EX Classwiz
Time: errors out immediately
Answer: N/A

2.  Sharp EL-W516T
Time: 1 minute, 6 seconds
Answer: error

3.  Texas Instruments TI-36X Pro
Time: 7 seconds
Answer: 0.148495519

4.  Casio fx-115ES Plus
Time: errors out after 1 second
Answer: N/A

Some Observations

1.  Not all calculations of improper integrals will be successful.

2.  Out of the four calculators tested, from the four calculations:  the Casio fx-991ES is the fastest, but I found the most successful with the Texas Instruments TI-36X Pro.

3.  Be ready to spend a little for calculations by using this method.

Source:

Mier-Jedrzejowic, W.A.C. Ph.D.  Extend Your 41  London, UK 1985  ISBN 0-9510733-0-03

Eddie

All original content copyright, © 2011-2019.  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.  Please contact the author if you have questions.

Tuesday, May 8, 2012

Calculus Revisited #16: Improper Integrals

Welcome to Part 16 of our 21 part Calculus Revisited series. Today we got down, dirty, and improper.

Improper Integrals


(I)

∞
∫ f(x) dx =
a

lim ( ∫(f(x) dx, a, t) as t → ∞

If f(r) is undefined:

(II)

a
∫ f(x) dx =
r

lim ( ∫f(x) dx, t, a) as t → r+ (t approaches r from the right side)

(III)

r
∫ f(x) dx =
a

lim ( ∫(f(x) dx, a, t) as t → r- (t approaches r from the left side)


Problems

1. Calculate:

4
∫ 2/(x - 2) dx
2

Note 2/(x - 2) is defined at x = 2. This is an improper integral.

∫( 2/(x - 2) dx, 2, 4)
= lim ∫( 2/(x - 2) dx, t, 4) as t → 2+
= lim (2 ln(4 - 2) - 2 ln(t - 2)) as t → 2+

Note: ln t has no limit as t → 0

Therefore the integral has no finite answer. Yes, that can happen.

2. Calculate:

3
∫ dx / √(3 -x)
0

Note that 1/√(3 - x) is undefined at x = 3. Another improper integral.

∫( 1 / √(3 - x) dx, 0, 3)
= lim ∫( 1 / √(3 - x) dx, 0, t) as t → 3-
= lim (- 2 * √(3 - t) + 2 * √(3 - 0) ) as t → 3-
= lim ( -2 * √(3 - t) + 2√3) as t → 3-
= 2√3 ≈ 3.46410

3. Calculate:

∞
∫ e^-x/2 dx
0

So:
∫ (e^(-x/2) dx, 0, ∞)
= lim (e^(-x/2) dx, 0, t) as t → ∞
= lim (-1/2* e^(-t/2) + 1/2 * e^0 ) as t → ∞
= 0 + 1/2
= 1/2

Next time we are going to work with sequences.

Until then, have a great day!

Eddie

This blog is property of Edward Shore. © 2012


Casio fx-50F/Radio Shack EC-4024 Program Collection: October 2026

Casio fx-50F/Radio Shack EC-4024 Program Collection: October 2026 Notes: * The fx-50F/EC-4024 has a 29 step program space betwe...