Saturday, 15 April 2017

number theory - Working With Large Exponents



I'm trying to understand the intuitions behind working with very large numbers. Specifically, I'm talking about numbers of the form ab where a>10,000 and b>10,000, and in general a and b are small, but ab has millions of digits. Obviously, computing the number is infeasible, but I still would like to determine things about them.



I am particularly interested in ideas or rules about evaluating which of two large numbers is larger. I believe I want to use logarithms somehow, but they've always confused me a little bit, so I can't quite see where to go from there.




More generally, I'd love to hear more generic discussion of how one can work with such large numbers easily, sacrificing precision, but not accuracy.


Answer



Since logarithms are monotonically increasing, you can determine if ab>cd

by instead checking if log(ab)>log(cd)
which can be rewritten (using basic properties of logarithms) as blog(a)>dlog(c)
This results in the comparison of two numbers on the order of those given in the input (that is, both numbers will be within an order of magnitude or so of a,b,c,d), which is definitely feasible on a computer.



You can also use logs to calculate other properties, as long as you remember to convert your solution back to the original numbers (by means of an exponential) when you're done. For example, to compute whether a1b1a2b2>c1d1c2d2

, you can take the log of both sides to get
log(a1b1a2b2)>log(c1d1c2d2)log(a1b1)+log(a2b2)>log(c1d1)+log(c2d2)b1log(a1)+b2log(a2)>d1log(c1)+d2log(c2)



which is again computationally feasible.


No comments:

Post a Comment

real analysis - How to find limhrightarrow0fracsin(ha)h

How to find limh0sin(ha)h without lhopital rule? I know when I use lhopital I easy get $$ \lim_{h\rightarrow 0}...