Showing posts with label rational functions. Show all posts
Showing posts with label rational functions. 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. 


Sunday, August 21, 2022

Rationalizing a Quadratic Polynomial

Rationalizing a Quadratic Polynomial


Problem


Rewrite the Quadratic Polynomial 1 + A*x + B*x^2 as a rational function of polynomials.  A and B are real numbers (however, this should work if A and B were complex numbers).  


1 + A*x + B*x^2 → p(x) / q(x)


Attempt 1:  1 + A*x + B*x^2 → (1 + C*x) / (1 + D*x)


1 + A*x + B*x^2 = (1 + C*x) / (1 + D*x)

(1 + A*x + B*x^2) * (1 + D*x) = (1 + C*x) / (1 + D*x) * (1 + D*x)

A*x + B*x^2 + D*x + A*D*x^2 + D*B*x^3 = C*x


Comparing the powers of x:


constant:  0 = 0

x:  A + D = C

x^2:  B + A*D = 0

x^3:  B*D = 0


This leads to either B=0 or D=0


Assume B=0. 

Then B + A*D = 0

A*D = 0


If A=0, then D = C, which leads to:

1 + A*x + B*x^2 = (1 + C*x) / (1 + D*x)

1 = (1 + C*x) / (1 + C*x)

1 = 1


If D=0, then A = C

1 + A*x + B*x^2 = (1 + C*x) / (1 + D*x)

1 + C*x = (1 + C*x) 


If D=0, then B=0, and we get the same results as above.   


Ultimately this transformation to (1 + C*x) / (1 + D*x) leads to nothing useful.


Attempt 2:  1 + A*x + B*x^2 → (1 + C*x^2) / (1 + D*x)

 

1 + A*x + B*x^2 = (1 + C*x^2) / (1 + D*x)

(1 + A*x + B*x^2) * (1 + D*x) = 1 + C*x^2 

(A + D)*x + (B + A*D)*x^2 + B*D*x^3 = C*x^2


Comparing the powers of x:


constant:  0 = 0

x:  A + D = 0

x^2:  B + A*D = C

x^3:  B*D = 0


A + D = 0 implies that A = -D or D = -A


Also either B = 0 or D = 0.


Assume B = 0. Then with A = -D:

A*D = C

-D*D = C

C = -D^2


1 + A*x + B*x^2 = (1 + C*x^2) / (1 + D*x)

1 -  D*x = (1 - D*x^2) / (1 + D*x)

1 -  D*x = ((1 - D*x) * (1 + D*x))/ (1 + D*x)

1 - D*x = 1 - D*x


If we assume that D = -A, then:

C = -A^2 and

1 + A*x = (1 - A*x^2) / (1 - A*x)

1 + A*x = ((1 - A*x)  * (1 + A*x)) / (1 - A*x)

1 + A*x = 1 + A*x


Assume D = 0.

Then A = 0 and B = C:

1 + B*x^2 = 1 + B*x^2

1 + C*x^2 = 1 + C*x^2


Again, we have transformations that are trivial.


Attempt 3:  1 + A*x + B*x^2 → (1 + C*x^3) / (1 + D*x)


1 + A*x + B*x^2 = (1 + C*x^3) / (1 + D*x)

(1 + A*x + B*x^2) * (1 + D*x) = 1 + C*x^3

(A + D)*x + (B + A*D)*x^2 + B*D*x^3 = 1 + C*x^3


Comparing the powers of x:


constant:  0 = 0

x:  A + D = 0

x^2:  B + A*D = 0

x^3:  B*D = C


This implies that:

A + D = 0

D = -A


B + A*D = 0

B+ A*-A = 0

B = A^2   (this restricts A and B)


B * D = C

(A^2)*(-A) = C

C = -A^3


We can conclude that B = A^2, C = -A^3, D = -A


The relationship between A, B, C, and D are all connected in this case.


Examples:


A = 2 ⇒ B = 4, C = -8, D = -2 and

1 + 2*x + 4*x^2 = (1 - 8*x^3) / (1 - 2*x)


A = -2 ⇒ B = 4, C = 8, D = 2 and

1 - 2*x + 4*x^2 = (1 + 8*x^3) / (1 + 2*x)



Note:  Casio fx-991EX Week - September 5, 2022 to September 9, 2022 


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. 


Monday, March 21, 2022

March Calculus Madness Sweet Sixteen - Day 6: ∫ √a ÷ (√(x+a) - √x) dx

 ------------


Welcome to March Calculus Madness!


------------


∫ √a ÷ (√(x+a) - √x) dx



Simplify:

√a ÷ (√(x+a) - √x)


Multiply by (√(x+a) + √x) ÷ (√(x+a) + √x) 


√a ÷ (√(x+a) - √x)

= √a ÷ (√(x+a) - √x) * (√(x+a) + √x) ÷ (√(x+a) + √x) 

= √a * (√(x+a) + √x) ÷ (x + a - x)

= 1 ÷ √a * (√(x+a) + √x)


Then:

∫ √a ÷ (√(x+a) + √x) dx

=  ∫ 1 ÷ √a * (√(x+a) + √x) dx

= a^(-1/2) * ∫ (x+a)^(1/2) + x^(1/2) dx

= 2 ÷ (3 * a^(1/2)) * ((x + a)^(3/2) + x^(3/2)) + C

= 2 ÷ (3 * a^0.5) * ((x + a)^1.5 + x^1.5) + C



Questions of preference:


Which is your preferred notation:


(1)  √x,  x^(1/2), or x^0.5?


(2)  x^(3/2) or x^1.5?  


Let us know in the comments.



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. 


RPN: DM32 and DM42: Stopping Sight Distance (Metric)

RPN: DM32 and DM42: Stopping Sight Distance (Metric) The Stopping Sight Distance Formula – Derivation The stopping sight di...