Thread: Past Exam help

  1. #1
    Registered User
    Join Date
    Oct 2012
    Posts
    5

    Past Exam help

    My Exam proctor know little to know English, and he grades from a solutions guide....and doesn't correct us or reveal solutions to us after the exams have been graded. So could anyone help me solve this:

    It can be shown that pi=4-(4/3)+(4/5)-(4/7)+... . Determine the minimum number of terms that must be included in the sum in order for the sum to differ from the true value of p by less than EPS, where EPS has previously been defined.

    Due to the University's lack of Numerical Methods, and my weak analytical/math skills this question was near impossible to solve. An ideas? Does Recursion come into play?

  2. #2
    TEIAM - problem solved
    Join Date
    Apr 2012
    Location
    Melbourne Australia
    Posts
    1,907
    Quote Originally Posted by GenghisAhn View Post
    My Exam proctor know little to know English, and he grades from a solutions guide....and doesn't correct us or reveal solutions to us after the exams have been graded. So could anyone help me solve this:

    It can be shown that pi=4-(4/3)+(4/5)-(4/7)+... . Determine the minimum number of terms that must be included in the sum in order for the sum to differ from the true value of p by less than EPS, where EPS has previously been defined.

    Due to the University's lack of Numerical Methods, and my weak analytical/math skills this question was near impossible to solve. An ideas? Does Recursion come into play?

    Sure - What have you come up with so far?
    Fact - Beethoven wrote his first symphony in C

  3. #3
    Registered User
    Join Date
    May 2012
    Posts
    505
    Start by writing a little program to print the first estimate of pi, (4), the second estimate (4 -4/3), and so on. Use an accurate value to about 14 decimal places as the true value. Then print out the difference between the estimate and the true value, for each step.
    I'm the author of MiniBasic: How to write a script interpreter and Basic Algorithms
    Visit my website for lots of associated C programming resources.
    https://github.com/MalcolmMcLean


  4. #4
    Registered User
    Join Date
    Sep 2008
    Location
    Toronto, Canada
    Posts
    1,834
    Since each successive fraction approaches zero, the least number of terms is simply as many until the fraction < EPS. Therefore the number of terms is at least 2 / EPS + 0.5.

    However, since it's a sum, we don't know whether the accumulated effect could affect the result after many more terms. My guess is that this problem did not call for an analytical solution but rather a programmatic one. Write the code and let the computer find the answer. No, recursion is not called for.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help with past yr exam paper
    By shermaine in forum C Programming
    Replies: 3
    Last Post: 10-27-2006, 01:45 AM
  2. How to get past the limit of an int?
    By Feite in forum C++ Programming
    Replies: 19
    Last Post: 08-19-2005, 04:19 AM
  3. Wont go past while statement
    By Extropian in forum C Programming
    Replies: 5
    Last Post: 07-25-2005, 10:08 AM
  4. Writing past ...
    By Ana Val sazi in forum C++ Programming
    Replies: 8
    Last Post: 06-29-2002, 08:43 AM