Like Tree1Likes

Approximating PI using the Taylor Series - Help!

This is a discussion on Approximating PI using the Taylor Series - Help! within the C++ Programming forums, part of the General Programming Boards category; I don't care - would just do 4 * arctan(1.0) anyway. I'd just use a constant. Soma...

  1. #31
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    4,230
    I don't care - would just do 4 * arctan(1.0) anyway.
    I'd just use a constant.

    Soma

  2. #32
    SAMARAS std10093's Avatar
    Join Date
    Jan 2011
    Location
    Nice, France
    Posts
    2,675
    Quote Originally Posted by phantomotap View Post
    I'd just use a constant.
    Soma
    Solution found

  3. #33
    Registered User
    Join Date
    May 2009
    Posts
    2,549
    Quote Originally Posted by phantomotap View Post
    I'd just use a constant.

    Soma
    I like M_PI from math.h.
    But, so far I have never needed it and had the compiler I was using supply it at the same time.

    Tim S.
    "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the Universe is winning." Rick Cook

  4. #34
    Registered User
    Join Date
    Oct 2006
    Posts
    2,361
    I might do the loop more like this:

    Code:
    double numerator = -1.0
    double taylor = 1.0;
    for (int i = 3; i < terms; i+=2, numerator *= -1)
    {
        taylor += numerator/i;
    }
    but to each his own.
    stahta01 likes this.

Page 3 of 3 FirstFirst 123
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Taylor series regarding E^x
    By rafacnsoccer in forum C++ Programming
    Replies: 8
    Last Post: 05-05-2010, 11:08 AM
  2. taylor series using only stdio.h
    By b0ss139 in forum C Programming
    Replies: 4
    Last Post: 07-25-2009, 10:32 PM
  3. help on c programming involving taylor series
    By harlow23 in forum C Programming
    Replies: 4
    Last Post: 05-04-2007, 10:03 PM
  4. taylor series using only stdio.h
    By faruque in forum C Programming
    Replies: 1
    Last Post: 02-13-2003, 11:50 AM
  5. taylor series expansion
    By noor_mirza in forum C++ Programming
    Replies: 1
    Last Post: 10-23-2002, 10:02 PM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21