home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / programm / 3541 < prev    next >
Encoding:
Internet Message Format  |  1993-01-21  |  1.5 KB

  1. Path: sparky!uunet!noc.near.net!hri.com!spool.mu.edu!news.nd.edu!mentor.cc.purdue.edu!news
  2. From: ags@seaman.cc.purdue.edu (Dave Seaman)
  3. Newsgroups: comp.programming
  4. Subject: Re: how to calculate PI
  5. Message-ID: <C17vvq.Msr@mentor.cc.purdue.edu>
  6. Date: 21 Jan 93 18:40:37 GMT
  7. References: <c8h3xpm@rpi.edu>
  8. Sender: news@mentor.cc.purdue.edu (USENET News)
  9. Organization: Purdue University
  10. Lines: 30
  11.  
  12. In article <c8h3xpm@rpi.edu> rogerj@aix.rpi.edu (Diversion (Jeff Rogers))  
  13. writes:
  14. > lowry@watson.ibm.com (Andy Lowry) writes:
  15. > >In any case, you can use Taylor expansion to get atan(1/5) and
  16. > >atan(1/239).  I understand there are more high-powered schemes out
  17. > Maybe this is the answer (to my question above), but I don't see why a
  18. > taylor expansion would work for some values and not others.
  19.  
  20. It's called "radius of convergence." The Taylor expansion in question is
  21.  
  22.     atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ...
  23.  
  24. and it turns out that the radius of convergence is 1. That means the  
  25. series converges for |x| < 1 and diverges for |x| > 1. For x = 1 you get
  26.  
  27.     pi/4 = atan(1) = 1 - 1/3 + 1/5 - 1/7 + ...
  28.  
  29. and the series converges, but with painful slowness. You have to add  
  30. around a thousand terms just to get three-digit accuracy, and for each  
  31. additional digit you need ten times as many terms. Compare this with
  32.  
  33.     atan(1/239) = 1/239 - 1/(3*239^3) + 1/(5*239^5) -  ...
  34.  
  35. which converges very rapidly, and you can see the advantage of using small  
  36. arguments in the atan series.
  37.  
  38. --
  39. Dave Seaman
  40. ags@seaman.cc.purdue.edu
  41.