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

You are not logged in.

- Topics: Active | Unanswered

Okay, help me out here

'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****bumpkin**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 109,606

What do you do first?

**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

Notice that cos(pi n) should be replaced with if (even n) then 1 else -1 because cos is expensive.

Then I compute partial sums, of course.

'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****bumpkin**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 109,606

I am paraphrasing but someone once said,

The purpose of math is to eliminate intelligent thought.

We compute partial sums without the noticing.

**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

I would still advice using the if-else defintion because that computes faster.

bobbym wrote:

Mathematicians like simplicity. I like speed.

'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****bumpkin**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 109,606

It will be fast enough for our purposes.

**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

Here are the partial sums for several powers of 2:

`[-0.5,-0.5833333333333333,-0.6345238095238095,-0.6628718503718505,-0.6777662022075269,-0.6853957082692488,-0.6892561888834033,-0.6911978702281084,-0.6921715717324437,-0.6926591377284127,-0.6929030995395857,-0.6930251251486118,-0.693086149128997,-0.6931166639131536,-0.6931319220037282,-0.6931395512236546]`

'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****bumpkin**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 109,606

To what powers?

**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

2^1, 2^2, ... 2^16

```
Prelude> pSum f n = sum $ take n [f m | m <- [1.0, 2.0 ..]]
Prelude> map (pSum (\n -> cos(pi*n)/n)) [2^n | n <- [1..16]]
[-0.5,-0.5833333333333333,-0.6345238095238095,-0.6628718503718505,-0.6777662022075269,-0.6853957082692488,-0.6892561888834033,-0.6911978702281084,-0.6921715717324437,-0.6926591377284127,-0.6929030995395857,-0.6930251251486118,-0.693086149128997,-0.6931166639131536,-0.6931319220037282,-0.6931395512236546]
```

'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****bumpkin**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 109,606

Please truncate that list for only 2^10. Do you see that convergence is slow? Now apply shanks acceleration to it.

**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

Before that, is Dimensions[l][[1]] the same as Length[l]?

'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****bumpkin**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 109,606

You never have to ask that sort of question of another person. Just ask M. Did it work?

**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

There is something weird with your code. What is x? Why do you increment it but not use it?

```
In[2]:= shanks[{-0.5,-0.5833333333333333,-0.6345238095238095,-0.6628718503718505,-0.6777662022075269,-0.6853957082692488,-0.6892561888834033,-0.6911978702281084,-0.6921715717324437,-0.6926591377284127}]
Out[2]= {-0.716049,-0.698052,-0.694255,-0.693408,-0.69321,-0.693163,-0.693151,-0.693148}
```

'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****bumpkin**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 109,606

What do you have for the last one in your list. We will look at the code later.

**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

Is -0.693148 the value we are looking for?

'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****bumpkin**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 109,606

Is that all the precision you have?

**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

I do not know how to get more precision.

'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****bumpkin**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 109,606

Hmmm, did you copy and paste that answer back into a notebook cell?

**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

No, I already have it in the notebook cell.

'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****bumpkin**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 109,606

Repaste the six digit answer in the notebook and you will see more.

**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

Oh okay, right. I got -0.6931481384212015

'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****bumpkin**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 109,606

Now what do you do?

**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

I check my answer in two ways.

'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****bumpkin**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 109,606

What answer?

**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

-0.693148...

'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