# Estimation of truncation error based on MATLAB for a sum calculation

The sum is $\sum_{k=1}^{\infty}\frac{(-1)^{k+1}}{k^2+k}$

Question: Determine this sum with 6 correct decimals. And Estimate the truncation error.

Firstly we know the MATLAB uses double precision, from binary number, we could find the smallest possible number that Matlab could use.

$x_s=m\beta^{e}$, let $e=-1022$, m has at most $52$ digits, then, $x_s=2^{-1074}$

And then, $k^2+k=2^{1074}$, this $k$ is the largest number of terms that Matlab could handle.

But I don't know how to continue.

-
Consider the first term that's less than $10^{-6}$ or so... – J. M. Nov 14 '11 at 15:08
@J.M. but I think the truncation is operated after summing up all the possible terms. If we cancel all terms which are less than $10^{-6}$, then the lost precision would be very large. – Xingdong Nov 14 '11 at 15:12
Then, why not just write the appropriate loop and make a conjecture (which you can subsequently prove)? – J. M. Nov 14 '11 at 15:14

This is an Alternating series. The error in approximating the infinite sum with the sum of the first $m$-terms is at most the absolute value of the $m+1$st term. Here $|a_{m+1}|={1\over (k+1)^2+k+1}$; so you just need to figure out when this is less than $0.000001$.
I'm saying $|{\rm error}|=|\sum_{k=m+1}^{\infty} {(-1)^{k+1}\over k^2+k} |\le {1\over (k+1)^2+k+1}$. (Also, the error will have the same sign as the $(m+1)st$-term.) – David Mitra Nov 14 '11 at 15:31