How calculators compute stuff (like irrational exponentiation)

davidbenari
Messages
466
Reaction score
18
I'm just curious as to how a calculator does the following operation:

##5^{1/\pi}##

I mean, it has to look for the number that raised to the power of pi, gives me 5. I think that's insane. How does it do that?

How does a calculator store the value of pi? -- I guess that's a more boring question because it might as well be it just "stores" it.
 
Mathematics news on Phys.org
it could convert the expression to log form and convert the answer back.

log(5)/pi = log(ans)
 
davidbenari said:
How does a calculator store the value of pi? -- I guess that's a more boring question because it might as well be it just "stores" it.
A calculator stores an approximation to pi.
 
Depends on your calculator, of course. We can use linear interpolation based methods if we want. Just repeat the operation to get within a needed precision. Let's demonstrate. We want to calculate ##5^{1/\pi}##. This is equivalent to finding the zero of
##f(x) = \log(x) - \pi^{-1} \log(5)##
We can assume that ##\pi^{-1}## is known, and also assume the logarithm function is cheap.
We need to test various points where the function changes sign. Suppose that ##f(s) < 0## and ##f(t) > 0## and s and t are near each other. Then
##x \approx \frac{sf(t)-tf(s)}{t-s}##.
Repeat until you get your desired precision.

There are faster techniques for trig functions, exponentials and logarithms (such as CORDIC and BKM). But these are for when you are working on a computer without hardware acceleration (very unlikely these days)
 
A typical calculator shows numbers to about 30 places and stores them to one more place than it shows. It would store "pi" as an integer,
"3141592..." and a power of 10- 0, since pi is between 1 and 0. Most calculators now use the "CORDIC" algorithms.
 
HallsofIvy said:
since pi is between 1 and 0
Surely you meant "between 1 and 10".
 
Insights auto threads is broken atm, so I'm manually creating these for new Insight articles. In Dirac’s Principles of Quantum Mechanics published in 1930 he introduced a “convenient notation” he referred to as a “delta function” which he treated as a continuum analog to the discrete Kronecker delta. The Kronecker delta is simply the indexed components of the identity operator in matrix algebra Source: https://www.physicsforums.com/insights/what-exactly-is-diracs-delta-function/ by...
Fermat's Last Theorem has long been one of the most famous mathematical problems, and is now one of the most famous theorems. It simply states that the equation $$ a^n+b^n=c^n $$ has no solutions with positive integers if ##n>2.## It was named after Pierre de Fermat (1607-1665). The problem itself stems from the book Arithmetica by Diophantus of Alexandria. It gained popularity because Fermat noted in his copy "Cubum autem in duos cubos, aut quadratoquadratum in duos quadratoquadratos, et...
I'm interested to know whether the equation $$1 = 2 - \frac{1}{2 - \frac{1}{2 - \cdots}}$$ is true or not. It can be shown easily that if the continued fraction converges, it cannot converge to anything else than 1. It seems that if the continued fraction converges, the convergence is very slow. The apparent slowness of the convergence makes it difficult to estimate the presence of true convergence numerically. At the moment I don't know whether this converges or not.

Similar threads

Replies
4
Views
2K
Replies
4
Views
2K
Replies
4
Views
1K
Replies
18
Views
10K
Replies
4
Views
2K
Back
Top