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

You are not logged in.

- Topics: Active | Unanswered

```
>>> n = 50
>>> a = 1241.0
>>> while n != 20:
... n -= 1
... a = ((1.0/n) - a)/8.0
...
>>> a
0.005585251327875914
```

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

So we have the recurrence

But of course it is ill conditioned and therefore needs to be run backwards.

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

Are you talking to me?

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

Sorry, I was solving the integral that anonimnystefy provided.

I did notice your nice solution in procedural style.

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

It does not match with your answer

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

You need to go one more. I would have put that n -=1 below the a = ((1.0/n) - a)/8.0

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

The classic off-by one error

'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

Anything else?

**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.005317989376992687 better?

'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

In numerical work you either know the answer or you do not. You can answer that question for yourself.

Anything further to discuss on NA?

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

**thickhead****Member**- Registered: 2016-04-16
- Posts: 1,086

Hopefully the answer is a_20=0.005877521

**{1}Vasudhaiva Kutumakam.{The whole Universe is a family.}(2)Yatra naaryasthu poojyanthe Ramanthe tatra Devataha{Gods rejoice at those places where ladies are respected.}**

Offline

**bobbym****bumpkin**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 109,606

Hi;

.005317989376992687

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

bobbym wrote:

In numerical work you either know the answer or you do not. You can answer that question for yourself.

Anything further to discuss on NA?

How do I chek the value of a_20?

'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

**thickhead****Member**- Registered: 2016-04-16
- Posts: 1,086

**{1}Vasudhaiva Kutumakam.{The whole Universe is a family.}(2)Yatra naaryasthu poojyanthe Ramanthe tatra Devataha{Gods rejoice at those places where ladies are respected.}**

Offline

**bobbym****bumpkin**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 109,606

The geometry of the integrand does not support Simpsons well but I tried it anyway. It got a pretty close answer.

To check, enter this at Wolfram Alpha:

NIntegrate[x^20/(x + 8), {x, 0, 1}, WorkingPrecision -> 20]

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

**thickhead****Member**- Registered: 2016-04-16
- Posts: 1,086

I think I had made some mistake in integration by Simpson rule It comes out to be 0.005318031 with same 100 divisions.

Not so bad.

**{1}Vasudhaiva Kutumakam.{The whole Universe is a family.}(2)Yatra naaryasthu poojyanthe Ramanthe tatra Devataha{Gods rejoice at those places where ladies are respected.}**

Offline

Agnishom wrote:

bobbym wrote:In numerical work you either know the answer or you do not. You can answer that question for yourself.

Anything further to discuss on NA?

How do I chek the value of a_20?

'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

Hi;

You are not convinced?

I use the 2 way method to check numerical work.

Hi thickhead;

I was amazed when I got it to work too. Perhaps, a bit of work on the integrand first, would be safer.

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

How did you check the value of a[20] 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

1) I have the analytical answer.

2) I evaluated the integral numerically.

3) I ran the recurrence in the backward direction.

**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 analytical answer?

'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, you have the mighty M, it is more powerful than all the m's put together. It is wiser than the Oracle at Delphi. You do not know how to get it?

where

is the HurwitzLerchPhi function.

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

Dioes the recurrence problem you gave me come from the integral?

'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

Of couse it does!

http://www.mathisfunforum.com/viewtopic … 57#p384157

Post #177. You should see that a minor change produces the recurrence of this thread.

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

Okay...

What's next?

'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