home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / programm / 3533 < prev    next >
Encoding:
Text File  |  1993-01-21  |  1.5 KB  |  44 lines

  1. Newsgroups: comp.programming
  2. Path: sparky!uunet!mcsun!ieunet!tcdcs!unix1.tcd.ie!bosullvn
  3. From: bosullvn@unix1.tcd.ie (Bryan O'Sullivan)
  4. Subject: Re: how to calculate PI
  5. Message-ID: <bosullvn.727615765@unix1.tcd.ie>
  6. Sender: usenet@cs.tcd.ie (NN required at ashe.cs.tcd.ie)
  7. Nntp-Posting-Host: unix1.tcd.ie
  8. Organization: Computer Science Department, Trinity College, Dublin, Ireland
  9. References: <peterd.727508100@tscc2> <LOWRY.93Jan20104500@rotor.watson.ibm.com> <c8h3xpm@rpi.edu>
  10. Date: Thu, 21 Jan 1993 11:29:25 GMT
  11. Lines: 31
  12.  
  13. rogerj@aix.rpi.edu (Diversion (Jeff Rogers)) writes:
  14.  
  15. >>Andy Lowry writes:
  16.  
  17. >>  pi/4 = 4*atan(1/5)-atan(1/239)
  18.  
  19. >Why not just 
  20. >   pi/4=atan(1)? 
  21. >If your answer is in radians, this works too, but
  22. >I think it requires prior knowledge of pi. 
  23.  
  24. Exactly.  It's a bit circular, no?  Seems the formula Andy Lowry
  25. quotes better lends itself to Taylor Series expansion.
  26.  
  27. >... but I don't see why a taylor expansion would work for some values
  28. >and not others.
  29.  
  30. Seems to work for all values, but I could well be wrong.  I've got
  31. a (totally uncommented and rather obtuse) variant of Gregory's
  32. algorithm written in C which churns out values fairly quickly; it's
  33. not particularly optimised, but takes about 7 seconds to churn out
  34. 1000 digits of pi on an unloaded SPARCstation.
  35.  
  36. I've not looked at any analyses, but it seems that Gregory's
  37. algorithm gets roughly exponentially slower with the number of
  38. digits of precision required.  Or perhaps it's just the variant I
  39. have.
  40.  
  41.     <b
  42. --
  43. SCRG, Department of Computer Science, Trinity College
  44.