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.