calculating the value of pi - Page 3


Page 3 of 4 FirstFirst 1234 LastLast
Results 31 to 45 of 46

Thread: calculating the value of pi

  1. #31
    Join Date
    Mar 2001
    Posts
    729
    One question I have though.. How is the computer calculating the trig functions? I like the sum one because I know what it is doing.

  2. #32
    Join Date
    Apr 2001
    Location
    SF Bay Area, CA
    Posts
    14,947
    The x86 math coprocessors (x87 if x <= 3) have instructions that can be used to calculate trig functions.

    I don't know how accurate (or precise) they are, though... probably only to the machine floating-point precision (either 32 or 64 bits, or 80 if your compiler supports "long double").

  3. #33
    Join Date
    Aug 2003
    Location
    South Dakota and Iowa
    Posts
    242

    the computer isn't...

    with the atan suggestions, the taylor series expansion is used...
    atan(x) = x - x^3/3 + x^5/5 - x^7/7 ...
    or
    atan(x) = summation from n=1 to infinity of (-1)^(n+1)*x^(2n-1) / (2n-1)
    so each iteration you just add another term and it gets closer to the exact value of atan(x), which can be used to find pi in a number of ways.

  4. #34
    Join Date
    Aug 2002
    Location
    Essex, UK
    Posts
    937
    Are you sure the computer uses Taylor series? They're very slow; I think x86s have some binary method which involves mathematical rotations.
    Registered Linux User #325947

    Check out Feather Linux, my distro.
    (Yes, it's shameless self promotion, deal with it )

  5. #35
    Join Date
    Aug 2003
    Location
    South Dakota and Iowa
    Posts
    242
    sorry, misunderstanding. no, i highly doubt that the computer uses the taylor series. i'm saying the programmer could use that method to get perfect accuracy for atan, instead of using the machine's approximation of atan.

  6. #36
    Join Date
    Jul 2003
    Posts
    28
    This page shows many unusual representationsmathworld.

  7. #37
    Join Date
    Sep 2003
    Location
    Edmonton, Alberta, Canada
    Posts
    311
    Originally posted by o0zi
    Why calculate when you know it to several places from memory?

    3.141592635358979323846264338327950288419716939937

    (yes, that was from memory)
    Damn! That is three digits more than I have memorized!
    MOUNT TAPE U1439 ON B3, NO RING

    Registered Linux user # 31337!

  8. #38
    Join Date
    Sep 2003
    Location
    North Carolina, USA
    Posts
    228
    just use the pi button on a calculator.

    ha ha.
    registered Linux user number 334502

    LinuxHelpMe

    i cant speal veri weel.

  9. #39
    Join Date
    Dec 1999
    Location
    Fargo, ND
    Posts
    1,817

    Question Million Dollar que$tion

    Why?

    Why do you need to calculate pi down so far?

    Are you perchance shooting a rocket across the galaxy and need to hit a target on Vega the size of a grapefruit or what?
    (That'd be really cool if you were though)
    Knute

    You live, you die, enjoy the interval!

  10. #40
    Join Date
    Aug 2002
    Location
    Essex, UK
    Posts
    937
    You might as well ask the same of most of mathematics - it's an intellectual pursuit which many people enjoy merely for the fun of it, and not the practical value.
    Registered Linux User #325947

    Check out Feather Linux, my distro.
    (Yes, it's shameless self promotion, deal with it )

  11. #41
    Join Date
    Aug 2003
    Location
    Auburn, WA
    Posts
    83
    Originally posted by o0zi
    Why calculate when you know it to several places from memory?

    3.141592635358979323846264338327950288419716939937

    (yes, that was from memory)
    Don't know if this was a typo or not, but a published value is:

    3.141592653589793238462643383279502884197169399375 11

    (you've got an extra 3 in the 8th digit to the right of the decimal point).


  12. #42
    Join Date
    Aug 2002
    Location
    Essex, UK
    Posts
    937
    Yup, sorry, typo

    3.141592653589793238462643383279502884197169399375 10582
    Registered Linux User #325947

    Check out Feather Linux, my distro.
    (Yes, it's shameless self promotion, deal with it )

  13. #43
    Join Date
    Mar 2001
    Posts
    729
    You just put that there to make us think you took it from memory.

    Impostor.

  14. #44
    Join Date
    Jul 2003
    Location
    Spokane, Washington
    Posts
    580
    Originally posted by drummerboy195
    we are working on sums of sequences in clac right now, and if it wasnt for the pesky change in signs every other number, it could be expressed as the sum of 4(1/(2i-1)) as i goes from 1 to infinity. except, the real sum should be 4(1/(2i-1)-1/(2i/1)+1/(2i-1)-1/(2i/1)+1/(2i-1)........) anybody know how to set that up?
    4*sum((-1)^(i+1)/(2*i-1),i,1,infinity)=4(1-1/3+1/5-1/7...)

  15. #45
    Join Date
    Sep 2002
    Location
    Boise, ID
    Posts
    653

    Re: Million Dollar que$tion

    Originally posted by knute
    Why?
    That's how nerds entertain themselves.

    Andrew Wiles locked himself up in an attic for 7 years working up a proof to Fermat's Last Theorem. Nobody knows what to do with it now, but at least Wiles had fun.
    - Andy

    Obligatorydistro link.

Posting Permissions

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