Results 1 to 15 of 15

Thread: Powers and Squirts

  1. #1

    Thread Starter
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Powers and Squirts

    How does a calculator. calculate roots and powers e.g:

    2 ^ 1/2
    2 ^ 4
    3 ^ 1/3

    ??

  2. #2
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    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.
    Have I helped you? Please Rate my posts.

  3. #3
    Lively Member
    Join Date
    Oct 2003
    Location
    Guildford, UK
    Posts
    91
    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...

  4. #4
    Only Slightly Obsessive jemidiah's Avatar
    Join Date
    Apr 2002
    Posts
    2,431
    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
    The time you enjoy wasting is not wasted time.
    Bertrand Russell

    <- Remember to rate posts you find helpful.

  5. #5

    Thread Starter
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906
    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.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  6. #6
    So Unbanned DiGiTaIErRoR's Avatar
    Join Date
    Apr 1999
    Location
    /dev/null
    Posts
    4,111
    e = 2.71828182846

    And uhm... e (1/2*ln(2)) = sqrt(2)

    That should be:

    e^(1/2*ln(x)) = sqrt(x)
    Last edited by DiGiTaIErRoR; Nov 26th, 2003 at 04:21 AM.

  7. #7
    Fanatic Member sql_lall's Avatar
    Join Date
    Jul 2002
    Location
    Up Above (i.e. AUS)
    Posts
    571

    Talking hehe

    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
    sql_lall

  8. #8

    Thread Starter
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906
    Yes x in the my last post was multiply. So what formula would a calculator use?

  9. #9
    Hyperactive Member sw_is_great's Avatar
    Join Date
    Nov 2003
    Posts
    330
    vb .net


    Math.Pow(a,y)
    Regards

  10. #10
    Only Slightly Obsessive jemidiah's Avatar
    Join Date
    Apr 2002
    Posts
    2,431
    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
    The time you enjoy wasting is not wasted time.
    Bertrand Russell

    <- Remember to rate posts you find helpful.

  11. #11

    Thread Starter
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906
    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...
    Do you have any more information on Newton-Rhapson approximation? After doing a google search I found nothing but hugley complex formula's which i don't understand.

    Does anyone have an idiots explanation??

  12. #12
    Only Slightly Obsessive jemidiah's Avatar
    Join Date
    Apr 2002
    Posts
    2,431
    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)
    The time you enjoy wasting is not wasted time.
    Bertrand Russell

    <- Remember to rate posts you find helpful.

  13. #13
    Addicted Member TheAlchemist's Avatar
    Join Date
    Jan 2003
    Location
    Dar-esSalaam,Tanzania
    Posts
    139
    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:
    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.
    Last edited by TheAlchemist; Dec 17th, 2003 at 03:15 PM.
    One thing that sustains me through life is the conciousness of the immense inferiority of everyone else
    --Oscar Wilde

  14. #14
    Junior Member
    Join Date
    Oct 2003
    Posts
    16

    Xelen

    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 >.<
    Last edited by Xelen; Dec 17th, 2003 at 09:49 PM.

  15. #15
    Junior Member
    Join Date
    Oct 2003
    Posts
    16

    Xelen

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width