Saturday, March 12, 2022

Casio fx-5800P: Multiplying Big Numbers - Laws of Logarithms

Casio fx-5800P: Multiplying Big Numbers - Laws of Logarithms


Introduction


This post was inspired by a recent video from Scott Collins, where he discussed what happens when multiplying numbers with large valued exponents:


https://www.youtube.com/watch?v=ziMIphyd9wg


Scientific calculators handle large numbers in the form M * 10^E where M is the mantissa and E is the exponent.  For most calculators, E ranges from -99 to +99.   For most Hewlett Packard calculators, the range expands to -499 to +499.  On CAS enabled calculators, the range usually tops out at -999 to +999.


At some point, if the exponent goes too small, say 10^-12 or less, the number is approximated with 0. 


For example, entering 4 *10^-56 * 2 * 10^-76 returns 0 on a lot of calculators, which the real answer is 8 * 10^-132.  


If you work with multiplying numbers of this magnitude, it may be useful to work with the mantissa and exponent parts separately, which can be the done thanks to the laws of exponents:


( A * 10^B ) * ( C * 10^D )

=  A * C * 10^B * 10^D

= ( A * C) * 10^(B + D)


Mantissa:  A * C

Exponent:  B + D


Similarly: 


( A * 10^B )^S * ( C * 10^D )^T

= (A^S * (10^B)^S) * (C^T * (10^D)^T)

= A^S * 10^(B*S) * C^T * 10^(D*T)

= (A^S * C^T) * 10^(B*S + D*T)


The program BIGMULT can automate this process, as well as adjust the answer to scientific notation form: #.####### * 10^# 


Casio fx-5800P Program:  BIGMULT


"(A×10^B)^(S)×(C×10^D)^(T)"

"A"?→A

"B"?→B

"S"?→S

"C"?→C

"D"?→D

"T"?→T

A^(S)×C^(T)→M

B×S+D×T→E

Intg(log(M))→S

M÷10^(S)→M

E+S→E

M ◢

E


The results:

Mantissa

Exponent


Note:  


Intg is the largest/greatest integer function, which allows us to fine tune our answer into the standard format.


Intg(log(M))→S

M÷10^(S)→M

E+S→E


Using the Int/IP (integer part) function would require additional adjustments.  


Examples


Example 1:

4 *10^-56 * 2 * 10^-76 


Input:

A = 4, B = -56, S = 1

C = 2, D = -76, T = 1


Result:

8

-132


8 * 10^-132



Example 2:

(2 * 10^5)^2 * (3 * 10^6)^3


Input:

A = 2, B = 5, S = 2

C = 3, D = 6, T = 3


Result:

1.08

30


1.08^30


Example 3:

(0.076 * 10^3)^2 * (0.9 * 10^2)^3


A = 0.076, B = 3, S = 2

C = 0.9, D = 2, T = 3


Result:

4.210704

9


4.210704 * 10^9



Until the next time,


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.