Showing posts with label limits. Show all posts
Showing posts with label limits. Show all posts

Sunday, January 21, 2024

Approximating Limits to Avoid Overflow

Approximating Limits to Avoid Overflow


For most 10-digit scientific calculators, the maximum that a number can be before an overflow error occurs is 9.999999999×10^99.



The Maximum Number



What is the maximum number x can be before the calculator overflows?   (For reference, I used a TI-84 Plus to calculate these numbers.)


Function:  Maximum Number


e^(x^2):   15.17427129


x!:   69    (most calculators only allow nonnegative integers for the factorial function)


3^x:   209.5903274


e^x:  230.2585093


2^x:  332.1928095


x^4:  slightly less than 1E25  (1 × 10^25)  (like 9.99999999999E24)


x^3:  2.15443469E33  (2.15443469 × 10^33)


x^2:  slightly less than 1E50  (1 × 10^50)  (like 9.99999999999E49)


x^(3/2):  4.641588833E66  (4.641588833 × 10^66)  



Limits to Infinity



Why is this important?    This could be useful in applications, say approximating values of y(x) when x approaches infinity.




Example 1:


y = ln(x) / x^3


To find the limit x can be, look at the function presented and select the "part" that has the lowest limit.   In this case, that "part" is x^3.  Approach to that limit.


y(1E33):  7.59853081E-98


y(1.5E33):  2.26343032E-98


y(2E33):  9.58480691E-99


y(2.1E33):  8.28498493E-99


It would appear that ln(x)/x^3 approaches 0 as x approaches ∞.



The key is to select x values that will not cause the calculator to provide the overflow error.



Example 2:  


y = e^x/x^2


e^x has a max x of 230.2585093, while x^2 has a max x of 9.99999999999E49.  To prevent an overflow, we must choose x values approaching the lower max, in this case, 230.2585093.


y(229.9):  1.321975623E95


y(230):  1.459738847E95


y(230.1):  1.611859E95


y(230.2):  1.779832347E95


It would appear that e^x/x^2 approaches ∞ as x approaches ∞.



Example 3:


y = (x^3 - 1) / (x! * x^2)


Since the factorial is involved, the highest x can be is 69.


But y(69) overflows in this case!   Then we have to select lower x values until we can get answers.  This can be a trial and error approach.


y(68):  overflow


y(67):  1.83706434E-93


y(66):  1.21246228E-91


y(65):  7.88100352E-90


Looking at the results from y(65), y(66), and y(67), it appears that (x^3 - 1) / (x! * x^2) approaches 0 as x approaches ∞.



Remember that this isn't proof, but we can get an idea how a rational function will behave.  We still need the tools such as the ratio, root, and other tests.



Eddie


All original content copyright, © 2011-2024.  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. 


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


Thursday, April 26, 2012

Calculus Revisited #4: Limits

Welcome to Calculus Revisited! This is blog entry #4 of a 21 blog entry series. Today, we will cover the basics of limits.

Limit: The limit of a function f(x) is a value of which a function approaches as x creeps closer and closer to it's target x=a. This is not the same as f(a).

In notation:

lim f(x) = L
x→a

The limit may or may not exist.

Left Side Limit: The limit of a function f(x) as x approaches a from the left side. Hence, x < a.

In notation:

lim f(x) = L
x→ a-

Right Side Limit: The limit of a function f(x) as x approaches a from the right side. Hence, x > a.

In notation:

lim f(x) = L
x→ a+

If the left side limit is equal to the right side limit, then the general limit exists at L.

Continuous Function: A function f(x) is continuous if a limit exists for each x in the domain (or specified interval), and that limit is the same as the function's value. It has been often said that you can graph continuous functions without lifting a pencil.

Common continuous functions include:
f(x) = p(x) (polynomials a_n * x^n + ... + a_0)
f(x) = e^x
f(x) = ln x (for x>0 only)
f(x) = sin x
f(x) = cos x

Properties of Limits

lim (f(x) + g(x)) = lim f(x) + lim g(x)

lim c *f(x) = c * lim f(x), c is a constant


Common Ways to Attack Limits

1. If f(x) is continuous, then

lim f(x) = L
x →a

for all x.

2. "Calculator Method": plug in various x_i as x approaches closer and closer to x = a (but not at x = a), observe the results and make a educated conclusion.

3. Graph the function. If graphing calculators are allowed, this is the time to use them.

Problems
1. Find

lim x^2 + 1
x→2

Using the "calculator method":

Left Side Limit: (x approaches 2 with x < 2)
f(2 - .01) = 4.9601
f(2 - .001) = 4.99601
f(2 - .0001) = 4.99960001
f(2 - 10^-9) = 4.999999996
The value is getting close to 5.

Right Side Limit: (x approaches 2 with x > 2)
f(2 + .01) = 5.0401
f(2 + .001) = 5.004001
f(2 + .0001) = 5.00040001
f(2 + 10^-9) = 5.000000004
The value is getting close to 5.

We can reasonably conclude that

lim x^2 + 1 = 5 as x → 2

We could have also observed that x^2 + 1 is continuous everywhere and figured the limit out by plugging in 2 for x.

Now let's go to a case where f(x) is not continuous everywhere.

2. Find

lim 1/(x-2)
x→2

f(2) = 1/0. So plugging in x=2 does not work here.

Left Side Limit: (x approaches 2 with x < 2)
f(2 - .001) = -1,000
f(2 - .0001) = -10,000
f(2 - .00001) = -100,000
f(2 - 10^-9) = -1,000,000,000
Note that f(x) is getting to be a very large negative number, towards -∞

Right Side Limit: (x approaches 2 with x > 2)
f(2 + .001) = 1,000
f(2 + .0001) = 10,000
f(2 + .00001) = 100,000
f(2 + 10^-9) = 1,000,000,000
Note that f(x) is getting to be a very large positive number, towards ∞

But -∞ ≠ ∞

3. Find

lim (sin x)/x
x→ 0

Again, f(0) = 0/0, the plugging it won't work.

Left Side Limit:
f(-.001) = .9999998333
f(-.0001) = .9999999983
f(-.00001) = 1 (calculator returns 1)

Right Side Limit:
f(.001) = .9999998333
f(.0001) = .9999999983
f(.00001) = 1 (calculator returns 1)

From the "Calculator Method":

lim (sin x)/x = 1
x → 0

The next time we will working with derivatives. See you next time, Eddie.

This blog is property of Edward Shore. © 2012

The MU Key on a Four Function Calculator and Programs for the DM42/HP 42S

  The MU Key on a Four Function Calculator and Programs for the DM42/HP 42S Not too long ago, I purchased this very colorful, four funct...