Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm approximating $\pi$ using a series in MATLAB. I can approximate to within a relative error of $3\times 10^{-10}$ of MATLAB's built-in value. How would I choose a sensible tolerance for my approximation? Would it possibly relate to machine epsilon?

share|cite|improve this question
Which series? ${}$ – J. M. Oct 5 '11 at 15:48
$ 1 - 1/3 + 1/5 - 1/7 + ...$ – kobrien Oct 5 '11 at 16:03
I'm afraid I do. I want to compare it to Matlab's built-in value for pi for a varying number of terms in this series. – kobrien Oct 5 '11 at 16:10
The usual criterion is to stop when the $k$-th term is less than the current partial sum times eps. – J. M. Oct 5 '11 at 16:20
Hmm, change that to "absolute value of the $k$-th term"... – J. M. Oct 5 '11 at 16:26
up vote 1 down vote accepted

"The usual criterion is to stop when the absolute value of the k-th term is less than the current partial sum times eps"

Thanks to @J.M.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.