How calculators compute stuff (like irrational exponentiation)

In summary, a calculator stores an approximation to pi and uses algorithms such as CORDIC or linear interpolation to calculate values involving pi. It typically stores pi as an integer and a power of 10 for efficient storage and calculation.
  • #1
davidbenari
466
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
  • #2
it could convert the expression to log form and convert the answer back.

log(5)/pi = log(ans)
 
  • #3
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.
 
  • #4
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)
 
  • #5
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.
 
  • #6
HallsofIvy said:
since pi is between 1 and 0
Surely you meant "between 1 and 10".
 

Related to How calculators compute stuff (like irrational exponentiation)

1. How do calculators handle irrational numbers?

Calculators use algorithms and mathematical formulas to approximate irrational numbers. They often use a technique called Taylor series expansion to approximate the value of irrational numbers.

2. Can calculators compute irrational exponents?

Yes, calculators have the capability to compute irrational exponents. They use algorithms and mathematical formulas to approximate the value of the exponent and then apply it to the base number.

3. What is the difference between a calculator and a computer in terms of computation?

Calculators are specialized devices designed for specific mathematical calculations, while computers have a wider range of functions and can perform more complex calculations. However, both use algorithms and mathematical formulas to compute numbers.

4. How do calculators ensure accuracy in computation?

Calculators use a combination of hardware and software to ensure accuracy in computation. They are programmed to follow mathematical rules and have built-in error detection and correction features.

5. Can calculators handle complex numbers?

Yes, most modern calculators have the ability to handle complex numbers. They use algorithms and mathematical formulas to perform calculations involving complex numbers, such as addition, subtraction, multiplication, and division.

Similar threads

Replies
6
Views
1K
Replies
10
Views
306
  • General Math
Replies
4
Views
1K
  • General Math
Replies
4
Views
1K
Replies
7
Views
845
  • General Math
Replies
4
Views
1K
Replies
9
Views
1K
Replies
18
Views
9K
Replies
5
Views
2K
Replies
1
Views
1K
Back
Top