Page 1 of 2 12 LastLast
Results 1 to 15 of 18

Math Help - Approximating pi

  1. #1
    Super Member Showcase_22's Avatar
    Joined
    Sep 2006
    From
    The raggedy edge.
    Posts
    782

    Approximating pi

    \pi=4\sum_{k=0}^{\infty} \frac{(-1)^k}{2k+1}

    Estimate the number of terms required to approximate \pi to within 10^{-10}.
    Here's what I have so far:

    \pi-4\sum_{k=N}^{\infty}\frac{(-1)^k}{2k+1} \leq 10^{-10}

    4 \sum_{k=0}^{\infty} \frac{(-1)^k}{2k+1}-4 \sum_{k=N}^{\infty} \frac{(-1)^k}{2k+1} \leq 10^{-10}

    4\sum_{k=N+1}^{\infty}\frac{(-1)^k}{2k+1} \leq 10^{-10}

    4(\frac{-1^{N+1}}{2N+3}+\frac{-1^{N+2}}{2N+5}+\frac{-1^{N+3}}{2N+7}+.........) \leq 10^{-10}

    4(\frac{-1^{N+1}}{2N+3}+\frac{-1^{N+2}}{2N+5}+\frac{-1^{N+3}}{2N+7}+.........) \leq 4(\frac{-1^{N+1}}{2N}+\frac{-1^{N+2}}{2N}+\frac{-1^{N+3}}{2N}+......) \leq 10^{-10}

    4\sum_{k=N+1}^{\infty}\frac{-1^k}{2k+1} \leq 4\frac{\frac{-1^{N+1}}{2N}}{1-(-1)} \leq 10^{-10}

    4\sum_{k=N+1}^{\infty}\frac{-1^k}{2k+1} \leq 4\frac{\frac{-1^{N+1}}{2N}}{2} \leq 10^{-10}

    4\sum_{k=N+1}^{\infty}\frac{-1^k}{2k+1} \leq \frac{-1^{N+1}}{N} \leq 10^{-10}

    Solving \frac{-1^{N+1}}{N} \leq 10^{-10} gives:

    -1^{N+1} 10^{10} \leq N

    Therefore N \geq 10^{10}+1 so N=10^{10}+1 terms.

    This seems to be a really big answer. I might just be confusing myself but I was also wondering if there was an easier way of doing it (if this is the right way).
    Follow Math Help Forum on Facebook and Google+

  2. #2
    MHF Contributor
    Jester's Avatar
    Joined
    Dec 2008
    From
    Conway AR
    Posts
    2,368
    Thanks
    43
    Quote Originally Posted by Showcase_22 View Post
    Here's what I have so far:

    \pi-4\sum_{k=N}^{\infty}\frac{(-1)^k}{2k+1} \leq 10^{-10}

    4 \sum_{k=0}^{\infty} \frac{(-1)^k}{2k+1}-4 \sum_{k=N}^{\infty} \frac{(-1)^k}{2k+1} \leq 10^{-10}

    4\sum_{k=N+1}^{\infty}\frac{(-1)^k}{2k+1} \leq 10^{-10}

    4(\frac{-1^{N+1}}{2N+3}+\frac{-1^{N+2}}{2N+5}+\frac{-1^{N+3}}{2N+7}+.........) \leq 10^{-10}

    4(\frac{-1^{N+1}}{2N+3}+\frac{-1^{N+2}}{2N+5}+\frac{-1^{N+3}}{2N+7}+.........) \leq 4(\frac{-1^{N+1}}{2N}+\frac{-1^{N+2}}{2N}+\frac{-1^{N+3}}{2N}+......) \leq 10^{-10}

    4\sum_{k=N+1}^{\infty}\frac{-1^k}{2k+1} \leq 4\frac{\frac{-1^{N+1}}{2N}}{1-(-1)} \leq 10^{-10}

    4\sum_{k=N+1}^{\infty}\frac{-1^k}{2k+1} \leq 4\frac{\frac{-1^{N+1}}{2N}}{2} \leq 10^{-10}

    4\sum_{k=N+1}^{\infty}\frac{-1^k}{2k+1} \leq \frac{-1^{N+1}}{N} \leq 10^{-10}

    Solving \frac{-1^{N+1}}{N} \leq 10^{-10} gives:

    -1^{N+1} 10^{10} \leq N

    Therefore N \geq 10^{10}+1 so N=10^{10}+1 terms.

    This seems to be a really big answer. I might just be confusing myself but I was also wondering if there was an easier way of doing it (if this is the right way).
    As the series is an alternating series, if you consider the sum up to n terms, the error is at most in the first term you neglect.

    So if

    S_n = \sum_{k=0}^{n-1} \frac{4 (-1)^k}{2k+1} then

    |E_n| \le \frac{4}{2n+1} \le 10^{-10} so n \ge \frac{4 \cdot 10^{10} - 1}{2}
    which is an over kill. For a better answer, you could use Taylor series with remainder.
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Lord of certain Rings
    Isomorphism's Avatar
    Joined
    Dec 2007
    From
    IISc, Bangalore
    Posts
    1,465
    Thanks
    6
    I don't know how to solve this problem, however the following implication is wrong:

    Quote Originally Posted by Showcase_22 View Post
    4(\frac{-1^{N+1}}{2N+3}+\frac{-1^{N+2}}{2N+5}+\frac{-1^{N+3}}{2N+7}+.........) \leq 4(\frac{-1^{N+1}}{2N}+\frac{-1^{N+2}}{2N}+\frac{-1^{N+3}}{2N}+......) \leq 10^{-10}

    4\sum_{k=N+1}^{\infty}\frac{-1^k}{2k+1} \leq 4\frac{\frac{-1^{N+1}}{2N}}{1-(-1)} \leq 10^{-10}
    You have used infinite term geometric series formula carelessly. The common ratio, here, is -1. And the geometric series formula does not apply...
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Super Member Showcase_22's Avatar
    Joined
    Sep 2006
    From
    The raggedy edge.
    Posts
    782
    awww, I thought I had the answer in the bag! =(

    I should have spotted there was an error there since I did know that any alternating decreasing sequence, when summed to infinity, can be rearranged to sum to any real number.

    The hardest part here is making the series 4 \sum_{k=N+1}^{\infty}\frac{-1^k}{2k+1} into a geometric series so it can be summed. I've just got no idea what to turn it into.
    Follow Math Help Forum on Facebook and Google+

  5. #5
    MHF Contributor Mathstud28's Avatar
    Joined
    Mar 2008
    From
    Pennsylvania
    Posts
    3,641
    Quote Originally Posted by Showcase_22 View Post
    awww, I thought I had the answer in the bag! =(

    I should have spotted there was an error there since I did know that any alternating decreasing sequence, when summed to infinity, can be rearranged to sum to any real number.

    The hardest part here is making the series 4 \sum_{k=N+1}^{\infty}\frac{-1^k}{2k+1} into a geometric series so it can be summed. I've just got no idea what to turn it into.
    But you cannot really make it into a geometric series. Instead, consider the series given by \frac{1}{1+x^2}=\sum_{n=0}^{\infty}(-1)^nx^{2n}. Now how could you get your sum from this? Hint in white: consider the integral from zero to one, consider it when the function is as it is and when it is in series notation.
    Follow Math Help Forum on Facebook and Google+

  6. #6
    Math Engineering Student
    Krizalid's Avatar
    Joined
    Mar 2007
    From
    Santiago, Chile
    Posts
    3,654
    Thanks
    13
    The series converges conditionally, hence, the integral approach it's just to get a simple value.
    Follow Math Help Forum on Facebook and Google+

  7. #7
    Super Member Showcase_22's Avatar
    Joined
    Sep 2006
    From
    The raggedy edge.
    Posts
    782
    Quote Originally Posted by Mathstud28 View Post
    But you cannot really make it into a geometric series. Instead, consider the series given by \frac{1}{1+x^2}=\sum_{n=0}^{\infty}(-1)^nx^{2n}. Now how could you get your sum from this? Hint in white: consider the integral from zero to one, consider it when the function is as it is and when it is in series notation.
    I would like to point out that I thought "whaaaaat...." and had to look at the hint. =(

    Is this what you mean:

    \int_0^1 \frac{1}{1+x^2} dx

    x=sinh^2u, \ \frac{dx}{du}=2 \ sinhu \ coshu

    \int_{sinh^2 0=0}^{sinh^2 1} \frac{2 \ sinh u \ cosh u}{1+sinh^2 u}du

    2\int_0^{sinh^2 1}\frac{sinh u \ cosh u}{cosh^2 u}du

    2 \int_0^{sinh^2 1} {tanh \ u}\ du= \ [ln (cosh u)]_0^{sinh^2 1}

    ?
    Follow Math Help Forum on Facebook and Google+

  8. #8
    MHF Contributor
    Jester's Avatar
    Joined
    Dec 2008
    From
    Conway AR
    Posts
    2,368
    Thanks
    43
    Quote Originally Posted by Showcase_22 View Post
    I would like to point out that I thought "whaaaaat...." and had to look at the hint. =(

    Is this what you mean:

    \int_0^1 \frac{1}{1+x^2} dx

    x=sinh^2u, \ \frac{dx}{du}=2 \ sinhu \ coshu

    \int_{sinh^2 0=0}^{sinh^2 1} \frac{2 \ sinh u \ cosh u}{1+sinh^2 u}du

    2\int_0^{sinh^2 1}\frac{sinh u \ cosh u}{cosh^2 u}du

    2 \int_0^{sinh^2 1} {tanh \ u}\ du= \ [ln (cosh u)]_0^{sinh^2 1}

    ?
    \int \frac{dx}{1+x^2} = \tan^{-1}x + c
    Follow Math Help Forum on Facebook and Google+

  9. #9
    Super Member Showcase_22's Avatar
    Joined
    Sep 2006
    From
    The raggedy edge.
    Posts
    782

    Question

    Ohhh....right. I saw my way of doing t and got lost in what I was doing.

    arctan \ x= x-\frac{x^3}{3}+\frac{x^5}{5}-\frac{x^7}{7}........=\sum_{k=0}^ {\infty}\frac{(-1)^{k}}{2k+1}

    I need: <br />
\pi=4\sum_{k=0}^{\infty} \frac{(-1)^k}{2k+1}<br />

    I see what I need here. From my original calculation I have:

    <br />
4 \sum_{k=0}^{\infty} \frac{(-1)^k}{2k+1}-4 \sum_{k=N}^{\infty} \frac{(-1)^k}{2k+1} \leq 10^{-10}<br />

    4arctan \ 1-4\sum_{k=N}^{\infty} \frac{(-1)^k}{2k+1} \leq 10^{-10}

    4 arctan \ 1 - 4(\frac{(-1)^N}{2N+1}+\frac{(-1)^{N+1}}{2N+3}+\frac{(-1)^{N+2}}{2N+5}+.......)

    \leq 4 arctan \ 1 - 4(\frac{(-1)^N}{1}+\frac{(-1)^{N+1}}{3}+\frac{(-1)^{N+2}}{5}+.......) \leq 10^{-10}

    4 arctan \ 1 - 4(-1)^N(\frac{1}{1}+\frac{-1}{3}+\frac{1}{5}+.......) \leq 10^{-10}

    4 arctan \ 1 -4(-1^N)arctan \ 1 \leq 10^{-10}

    4arctan \ 1 (1-(-1^N) \leq 10^{-10}

    1-(-1^N) \leq \frac{1}{10^{10}( 4arctan 1)}

    1-\frac{1}{10^{10}(4arctan 1)} \leq -1^N

    hmm, surely this is just valid for N=2?
    Follow Math Help Forum on Facebook and Google+

  10. #10
    Member
    Joined
    May 2006
    Posts
    244
    Quote Originally Posted by Showcase_22 View Post
    Here's what I have so far:

    \pi-4\sum_{k=N}^{\infty}\frac{(-1)^k}{2k+1} \leq 10^{-10}

    4 \sum_{k=0}^{\infty} \frac{(-1)^k}{2k+1}-4 \sum_{k=N}^{\infty} \frac{(-1)^k}{2k+1} \leq 10^{-10}

    4\sum_{k=N+1}^{\infty}\frac{(-1)^k}{2k+1} \leq 10^{-10}

    4(\frac{-1^{N+1}}{2N+3}+\frac{-1^{N+2}}{2N+5}+\frac{-1^{N+3}}{2N+7}+.........) \leq 10^{-10}

    4(\frac{-1^{N+1}}{2N+3}+\frac{-1^{N+2}}{2N+5}+\frac{-1^{N+3}}{2N+7}+.........) \leq 4(\frac{-1^{N+1}}{2N}+\frac{-1^{N+2}}{2N}+\frac{-1^{N+3}}{2N}+......) \leq 10^{-10}

    4\sum_{k=N+1}^{\infty}\frac{-1^k}{2k+1} \leq 4\frac{\frac{-1^{N+1}}{2N}}{1-(-1)} \leq 10^{-10}

    4\sum_{k=N+1}^{\infty}\frac{-1^k}{2k+1} \leq 4\frac{\frac{-1^{N+1}}{2N}}{2} \leq 10^{-10}

    4\sum_{k=N+1}^{\infty}\frac{-1^k}{2k+1} \leq \frac{-1^{N+1}}{N} \leq 10^{-10}

    Solving \frac{-1^{N+1}}{N} \leq 10^{-10} gives:

    -1^{N+1} 10^{10} \leq N

    Therefore N \geq 10^{10}+1 so N=10^{10}+1 terms.

    This seems to be a really big answer. I might just be confusing myself but I was also wondering if there was an easier way of doing it (if this is the right way).
    Numerical experiment is always worth a look:

    Code:
    log_10(N)         log_10(|error|)
      2                    -2.0043
      3                    -3.0003
      4                    -4.00004
      5                    -5.00000
      6                    -6.00000
      7                    -7.00000
    at which point brute force runs out of umph!

    But it looks like a tight bound on the number of terms needed should be ~=10^10

    .
    Last edited by Constatine11; January 1st 2009 at 12:34 AM.
    Follow Math Help Forum on Facebook and Google+

  11. #11
    Member
    Joined
    May 2006
    Posts
    244
    An alternative approach to this problem is to group the terms in pairs to turn the series into a series of decreasing positive terms, then to get bounds for the sum of the tail by constructing integrals that over and under estimate the sum of the tail.

    We start by writting:

     <br />
\sum_{k=0}^{\infty} \frac{(-1)^k}{2k+1}=\sum_{n=0}^{\infty}\left( \frac{1}{4n+1}-\frac{1}{4n+3}\right)=\sum_{n=0}^{\infty}\frac{2}{  (4n+1)(4n+3)}<br />

    (though if we need N terms this series to get the error under 10^{-10} we need 2N terms of the original series)

    .
    Last edited by Constatine11; January 1st 2009 at 12:47 AM.
    Follow Math Help Forum on Facebook and Google+

  12. #12
    MHF Contributor Mathstud28's Avatar
    Joined
    Mar 2008
    From
    Pennsylvania
    Posts
    3,641
    Quote Originally Posted by Showcase_22 View Post
    I would like to point out that I thought "whaaaaat...." and had to look at the hint. =(

    Is this what you mean:

    \int_0^1 \frac{1}{1+x^2} dx

    x=sinh^2u, \ \frac{dx}{du}=2 \ sinhu \ coshu

    \int_{sinh^2 0=0}^{sinh^2 1} \frac{2 \ sinh u \ cosh u}{1+sinh^2 u}du

    2\int_0^{sinh^2 1}\frac{sinh u \ cosh u}{cosh^2 u}du

    2 \int_0^{sinh^2 1} {tanh \ u}\ du= \ [ln (cosh u)]_0^{sinh^2 1}

    ?
    \int_0^1\frac{dx}{1+x^2}=\arctan(x)\bigg|_{x=0}^{x  =1}=\frac{\pi}{4}

    But also note that

    \begin{aligned}\int_0^1\frac{dx}{1+x^2}&=\int_0^1\  sum_{n=0}^{\infty}(-1)^nx^{2n}dx\\<br />
&=\sum_{n=0}^{\infty}\int_0^1(-1)x^{2n}dx\quad{\color{red}(*)}\\<br />
&=\sum_{n=0}^{\infty}\frac{(-1)^n}{2n+1}\end{aligned}

    So we can conclude that \sum_{n=0}^{\infty}\frac{(-1)^n}{2n+1}=\frac{\pi}{4}


    Note: The following may be unesccesary, but just in case.

    \color{red}(*) can be justified using Abel's Test for Uniform Convergence since if we let f_n(x)=x^n and \frac{(-1)^n}{2n+1}=a_n we can see that \sum a_n converges and f_n(x) is nonincreasing and bounded on [0,1]
    Follow Math Help Forum on Facebook and Google+

  13. #13
    Super Member Showcase_22's Avatar
    Joined
    Sep 2006
    From
    The raggedy edge.
    Posts
    782
    Quote Originally Posted by Constatine11 View Post
    An alternative approach to this problem is to group the terms in pairs to turn the series into a series of decreasing positive terms, then to get bounds for the sum of the tail by constructing integrals that over and under estimate the sum of the tail.

    We start by writting:

     <br />
\sum_{k=0}^{\infty} \frac{(-1)^k}{2k+1}=\sum_{n=0}^{\infty}\left( \frac{1}{4n+1}-\frac{1}{4n+3}\right)=\sum_{n=0}^{\infty}\frac{2}{  (4n+1)(4n+3)}<br />

    (though if we need N terms this series to get the error under 10^{-10} we need 2N terms of the original series)

    .
    That's a very clever method!

    \pi= \sum_{k=0}^{\infty} \frac{(-1)^k}{2k+1}

    \sum_{k=0}^{\infty} \frac{(-1)^k}{2k+1}-\sum_{k=0}^{N} \frac{(-1)^k}{2k+1} \leq 10^{-10}

    \sum_{k=0}^{\infty} \frac{(-1)^k}{2k+1}-\sum_{n=0}^{2N} \frac{2}{(4n+1)(4n+3)} \leq 10^{-10}

    So is this what I need to work out? n=\frac{k}{2} if k is even, but can I use this fact at all? (or is this what you used to get the sum to 2N?).

    I have another query: Since this series is a sum to infinity, can the individual terms be grouped together in this way? I was wondering this because if a_n=\frac{1}{2k+1} then a_n is a decreasing null sequence of non-negative terms. Therefore \sum_{k=0}^{\infty} (-1)^k a_n can be used to sum the series to any real number.
    Follow Math Help Forum on Facebook and Google+

  14. #14
    Super Member Showcase_22's Avatar
    Joined
    Sep 2006
    From
    The raggedy edge.
    Posts
    782
    This question relies on the fact that E=|S_{n+1}-S_n| where E= error (I think so anyway).

    Therefore:

    |S_{n+1}-S_n| \leq 10^{-10}

    4|\sum_{k=(n+1)}^\infty\frac{(-1^k)}{2k+1}-\sum_{k=n}^{\infty}\frac{(-1)^k}{2k+1}| \leq 10^{-10}

    4|\frac{-1^{n+1}}{2(n+1)+1}| \leq 10^{-10}

    4(\frac{1}{2n+3}) \leq 10^{-10}

    \frac{4}{2n+3} \leq \frac{1}{10^{10}}

    4 \cdot10^{10} \leq 2n+3

    4 \cdot 10^{10}-3 \leq 2n

     4 \cdot \frac{10^{10}-3}{2} \leq n

    so N \geq 2(10^{10}-3)

    This is pretty big given constatine11's "brute strength" approach from before. However, I think this is about right because I can't see any other way of doing it!
    Follow Math Help Forum on Facebook and Google+

  15. #15
    Member
    Joined
    May 2006
    Posts
    244
    Quote Originally Posted by Constatine11 View Post
    An alternative approach to this problem is to group the terms in pairs to turn the series into a series of decreasing positive terms, then to get bounds for the sum of the tail by constructing integrals that over and under estimate the sum of the tail.

    We start by writting:

     <br />
\sum_{k=0}^{\infty} \frac{(-1)^k}{2k+1}=\sum_{n=0}^{\infty}\left( \frac{1}{4n+1}-\frac{1}{4n+3}\right)=\sum_{n=0}^{\infty}\frac{2}{  (4n+1)(4n+3)}<br />

    (though if we need N terms this series to get the error under 10^{-10} we need 2N terms of the original series)

    .
    The idea here is that if f(x) is a positive decreasing function for x>n-1 then

    \int_{n-1}^{\infty} f(x)\ dx \ge \sum_{k=n}^{\infty}f(k) \ge \int_{n}^{\infty} f(x)\ dx

    So finding an N such that

    \int_{N-1}^{\infty} f(x)\ dx < \frac{10^{-10}}{4}

    will give us a number of terms that will suffice to give the required error limit on the sum.

    Doing the sums (at this point I resort to the use of Maxima for doing the integral. and the algebra) gives N\approx 5\times 10^9 (in fact slightly less if we use double precision floating point, but with higher precision we find that any N>5 \times 10^9 will do) but this is half the number of terms needed for the original series so for the original series you need no more than 10^{10}+2 terms

    .
    Last edited by Constatine11; January 4th 2009 at 08:01 PM.
    Follow Math Help Forum on Facebook and Google+

Page 1 of 2 12 LastLast

Similar Math Help Forum Discussions

  1. Approximating sin(x).
    Posted in the Calculus Forum
    Replies: 14
    Last Post: July 10th 2010, 11:45 PM
  2. Approximating Squareroot
    Posted in the Calculus Forum
    Replies: 3
    Last Post: April 27th 2010, 11:15 AM
  3. approximating (I+Ab)^-1
    Posted in the Advanced Algebra Forum
    Replies: 4
    Last Post: July 26th 2009, 01:34 PM
  4. Approximating sinh(x)-sin(x)
    Posted in the Calculus Forum
    Replies: 2
    Last Post: October 20th 2008, 11:47 AM
  5. Approximating pi!!!!!!!!!!
    Posted in the Calculus Forum
    Replies: 1
    Last Post: August 11th 2008, 04:29 AM

Search Tags


/mathhelpforum @mathhelpforum