How does a calculator. calculate roots and powers e.g:
2 ^ 1/2
2 ^ 4
3 ^ 1/3
??
Printable View
How does a calculator. calculate roots and powers e.g:
2 ^ 1/2
2 ^ 4
3 ^ 1/3
??
I don't know, but I though sqrt was a standard function, along with +,-,*,/,Sin,Cos,Tan and modulus.
There is no way to calculate the sqrt of something without trail and improvement.
They most likely use the Newton-Rhapson approximation as the base for an iteration because it converges so quickly it leaves a trail of smoke behind it. Or maybe they don't because I can't think of a suitable way of applying it...
I believe they use logarithms, ie. 10^(Log(x)/[base, say 2 for square root])
Edit. On second thought, that's a bit exclusionary. Oh well, I'm sure Google knows :)
I found this formula which appears to work - only with powers. But as a root is 1 / power it works with roots too:
e (i . ln b)
where i is the index and b is the base;
therefore sqrt 4 is:
e (1/2 x ln 2) = 2
I touched on e and ln in my AS mathematics but don't remember how they work and how to calculate them. However could this be how a calculator does it?
The trial and error method seems interesting but I didn't think computers liked trial and error.
e = 2.71828182846
And uhm... e (1/2*ln(2)) = sqrt(2)
That should be:
e^(1/2*ln(x)) = sqrt(x)
No, i don't think the calculator can work out powers by using powers, cos how does it calculate these?
There would be some sort of converging algorithm, like as suggested by TheManWhoCan.
oh, and clearing up possible confusion, i think the x in visualAd's post was 'multiplied', not a variable
Yes x in the my last post was multiply. So what formula would a calculator use?
vb .net
Math.Pow(a,y)
lol
Actually, you all just restated what I said originally, except using the natural log instead of common log and e instead of 10 :)
It probably does just use some type of converging series, although you could always email TI
Do you have any more information on Newton-Rhapson approximation? After doing a google search I found nothing but hugley complex formula's :eek: which i don't understand.Quote:
Originally posted by TheManWhoCan
They most likely use the Newton-Rhapson approximation as the base for an iteration because it converges so quickly it leaves a trail of smoke behind it. Or maybe they don't because I can't think of a suitable way of applying it...
Does anyone have an idiots explanation??
You know, if anyone has the C/C++ header math.h, you could post the 'pow' function (I'd do it myself, by I only took a C/C++ class at school so I don't have a copy)
hey guys,
check out the thread by me on Mandelbrot fractals. You'll find a post by Guv of a very interesting variation of the newton rhapson method that is the one most probably used by calculators.
give me a few minutes, i'll see if i can copy and paste it here~
edit: by Guv:
Quote:
TheAlchemist: Complex arithmetic is required for convergence to complex as well as real roots. The following is the Newton method for various roots, starting with square root. The pattern is obvious if you want to work with higher roots.
NextZ = Z / 2 + Number / 2*Z (Number is the value you want the square root of).
NextZ = 2*Z / 3 + Number / 3*z2
NextZ = 3*Z / 4 + Number / 4*Z3
NextZ = 4*Z / 5 + Number / 5*Z4
Use NextZ as Z for the next iteration. It converges fairly fast.
Ok I may have missed anyone who said this, but to put a number to a fraction is to put it to a radical.
4^1/2 = 2, because its like saying square root of 4.
9^1/3 = 3, because it is cube root,
16^1/4 = 2 and etc...
now the top number is the exponential power of the simplified number.
16^4/4 is the power of 1 and it would evaluate to itself.
Now say we have 8^2/3 it is 2^2 = 4. Hope this helps anyone who is curious as to what fractions mean in an exponential position.
edit
------------
gah, twice was it mentioned, I missunderstood the question to first post >.<
Ok I may have missed anyone who said this, but to put a number to a fraction is to put it to a radical.
4^1/2 = 2, because its like saying square root of 4.
9^1/3 = 3, because it is cube root,
16^1/4 = 2 and etc...
now the top number is the power of the simplified number. So 16^4/4 is the power of 1 and it would evaluate to itself. Now say we have 8^2/3 it is 2^2 making it 4. Hope this helps anyone who is curious