Discussion about math, puzzles, games and fun. Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ π -¹ ² ³ °

You are not logged in.

- Topics: Active | Unanswered

Pages: **1**

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 107,133

Hi;

This question appears on another site and is answered there:

How many terms are required to get the value of this sum

with an error <= .0001?

We know from the Leibniz rule for alternating series that the tail of that series is less than the magnitude of the first neglected term. So we solve after making some simplifications

`Solve[1/(3n+1)==1/10000,n]`

yields n = 3333. This tells us we will need 3333 terms to get an error <= .0001 This is a well known way to bound these but we can see that it is not the sharpest. A direct summation shows we really only need about half of that.

An offhand comment by alex.jordan over here

http://math.stackexchange.com/questions … 55-0-553-3

suggests taking the mean of two consecutive partial sums. This might result in faster convergence and therefore less terms to get the desired error.

Now we are searching for the smallest b that yields a difference <= .0001 in that equation.

M can do that easily...

```
NMinimize[{b,Abs[Sum[(-1)^n/(3n+1),{n,0,\[Infinity]}]-(2Sum[(-1)^n/(3n+1),{n,0,b}]
+(-1)^(b+1)/(3(b+1)+1))/2]<1/10000,3333>b>0},b]
```

yields b -> 27.52553345330246, so we will use b = 28.

To check,

```
s = Sum[(-1)^n/(3 n + 1), {n, 0, \[Infinity]}];
s-(2Sum[(-1)^n/(3n+1),{n,0,b}]+(-1)^(b+1)/(3(b+1)+1))/2/.b->28.
```

(*-0.00009679302515119836 + 1.981492161077011*10^-17 I*)

That imaginary part is a bit of fungus and we we can ignore it. We see we do indeed have an absolute value error of less than .0001 and have used just 29 terms to get it, instead of 3333 as predicted by the Leibniz riule.

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**** Always satisfy the Prime Directive of getting the right answer above all else.**

Offline

**ElainaVW****Member**- Registered: 2013-04-29
- Posts: 571

Hello Bobby:

Did you really really really need MMA to solve

?Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 107,133

Hi;

You would be suprised at the type of arithmetic errors that people can make, or maybe you should not. Computers, do not make those type of errors.

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**** Always satisfy the Prime Directive of getting the right answer above all else.**

Offline

What is the Leibniz rule about?

'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

I'm not crazy, my mother had me tested.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 107,133

The Leibniz rule is for alternating series. The most famous alternating series is of course the simplest:

The Leibniz rule says that if the alternating series is convergent the tail can be estimated by the magnitude of the first neglected term.

For instance in the series given above. If I wish to have an estimate of the tail.

I could bound it using the Leibniz rule it is:

meaning it is less than or equal to .166666666...

As I said in post #1 this is not the sharpest bound, that is what this thread is about.

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**** Always satisfy the Prime Directive of getting the right answer above all else.**

Offline

Pages: **1**