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

You are not logged in.

- Topics: Active | Unanswered

**bobbym****bumpkin**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 108,529

That is a floating point number.

Take it over to Ries and get an 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

RIES does say it is -log(2)

'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: 108,529

So verify that experimentally a bit more by doing 2^11 and 2^12. Does that seem to fit the conjecture that Ries got?

Also note how much closer shanks got us over 2^10.

This was an easy example just to illustrate some of the ideas.

You are correct about the x in the routine. It is a leftover from debugging that I forgot to remove, Anyway, that code is not mine and is very primitive.

**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 does Shanks work?

'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: 108,529

Hmmm, that is a question beyond the scope of this thread.

One thing at a time. Have you worked on the integral?

**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 much about computing integrals experimentally

'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: 108,529

Teakettle principle...apply 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

Fine, I will look it up.

'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: 108,529

Nope, EM uses the same methods to do all problems, just as the TP advises. Compute the numeric integral and then fit those constants.

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

Using the shanks method?

'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: 108,529

Try NIntegrate.

Using the shanks method?

Shanks works on a sequence. You must generate that sequence.

`NIntegrate[Log[2 x]/x^2, {x, 1, \[Infinity]}, WorkingPrecision -> 40]`

`NIntegrate[Log[2 x]/x^2, {x, 1, \[Infinity]}, WorkingPrecision -> 80]`

`FindInstance[{Abs[(1.69314718055994530941723212145817656807) - (a + b*Log[c])] < 1/10, a > 0, b > 0, c > 0}, {a, b, c}, Integers]`

**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 if I try to implement NIntegrate myself?

'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: 108,529

How do you mean? If you check post #61 you will see I have given you my solution to the problem. In this one shanks was not necessary but a PSLQ like FindInstance was.

**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 about this idea:

1. Use some numerical integration to compute some partial integrals.

2. Use shanks to get more digits.

3. Use RIES.

'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: 108,529

That might work I have not done it.

My approach was given in post #61.

What if I try to implement NIntegrate myself?

It is possible to implement your own numeric integration routines but it has already been done for you.

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

So has been symbolic integration, but I am trying to learn here

Here is what I did:

```
simpsonIntegrate f partSize a b= sum $ map partIntegrate parts
where
parts = [(x,x+partSize) | x <- [a,a+partSize..b-partSize]]
partIntegrate (a, b) = ((b-a)/6)*((f a) + 4*(f ((a+b)/2)) + (f b))
shanks xs | length xs < 3 = []
shanks (x:y:z:xs) = new : shanks (y:z:xs)
where new = (x * z - y^2)/(z - 2*y + x)
```

And then:

```
*Main> f = (\x -> (log(2*x)/x^2))
*Main> map (simpsonIntegrate f 0.1 1.0) [2.0^x | x <- [1..16]]
[0.499999672473893,0.9232864746967729,1.221573270604151,1.4140383670002004,1.5319317645720105,1.6017088880533286,1.6420126621420745,1.664872155360511,1.6776557050567704,1.684724381448411,1.688597170415978,1.69070279028564,1.6918402129134391,1.6924512305738064,1.6927778925772454,1.6929518001656139]
*Main> shanks it
[1.9333733355426739,1.7640876810992894,1.718314177875799,1.7028980813846826,1.6971266630708697,1.6948279004031708,1.6938744484902646,1.6934675649393478,1.6932902313398943,1.6932116815066791,1.693176438817163,1.693160461308236,1.6931531552526713,1.693149790183461]
```

'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: 108,529

There could be problems with that approach.

**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 am not getting enough digits.

By the way, the last command in #61 does not work.

'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: 108,529

Try this:

```
FindInstance[{Abs[(1.69314718055994530941723212145817656807) - (a +
b*Log[c])] < 1/10, 10 > a > 0, b > 0, c > 0}, {a, b,
c}, Integers]
```

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

That works! Why does the last thing not work but this does?

'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: 108,529

Because the range of the 3 variables was too large for him.

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

*her.

by the way, you were using x. I failed to notice it. Your implementation is not purely functional though.

'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: 108,529

Which implementation of what?

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

```
shanks xs | length xs < 3 = []
shanks (x:y:z:xs) = new : shanks (y:z:xs)
where new = (x * z - y^2)/(z - 2*y + x)
```

is more functional than

```
shanks[l_] := Module[{x, n, w}, w = l; x = 1;
For[n = 3, n <= Dimensions[l][[1]], ++n,
w[[x]] = (w[[n - 2]]*w[[n]] - w[[n - 1]]^2)/
(w[[n]] - 2*w[[n - 1]] + w[[n - 2]]);
x = x + 1; ];
w = Take[w, Dimensions[w][[1]] - 2]
];
```

'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: 108,529

Of course it is. But I did not write that code. I think I already said it was primitive.

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