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

You are not logged in.

## #51 2016-12-17 05:37:41

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

### Re: Because he asked.

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

## #52 2016-12-18 01:26:36

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,838
Website

### Re: Because he asked.

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

## #53 2016-12-18 04:47:58

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

### Re: Because he asked.

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

## #54 2016-12-18 13:13:28

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,838
Website

### Re: Because he asked.

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

## #55 2016-12-18 13:15:20

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

### Re: Because he asked.

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

## #56 2016-12-18 13:23:28

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,838
Website

### Re: Because he asked.

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

## #57 2016-12-18 13:24:38

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

### Re: Because he asked.

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

## #58 2016-12-18 13:28:12

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,838
Website

### Re: Because he asked.

Fine, I will look it up.

'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

## #59 2016-12-18 13:29:50

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

### Re: Because he asked.

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

## #60 2016-12-18 13:36:19

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,838
Website

### Re: Because he asked.

Using the shanks method?

'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

## #61 2016-12-18 13:37:35

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

### Re: Because he asked.

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

## #62 2016-12-18 14:13:53

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,838
Website

### Re: Because he asked.

What if I try to implement NIntegrate myself?

'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

## #63 2016-12-18 14:16:32

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

### Re: Because he asked.

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

## #64 2016-12-18 14:43:58

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,838
Website

### Re: Because he asked.

1. Use some numerical integration to compute some partial integrals.
2. Use shanks to get more digits.
3. Use RIES.

'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

## #65 2016-12-18 14:50:11

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

### Re: Because he asked.

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

## #66 2016-12-18 14:51:58

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,838
Website

### Re: Because he asked.

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]``````

'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

## #67 2016-12-18 14:55:16

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

### Re: Because he asked.

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

## #68 2016-12-18 14:57:39

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,838
Website

### Re: Because he asked.

I am not getting enough digits.

By the way, the last command in #61 does not 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

## #69 2016-12-18 15:04:01

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

### Re: Because he asked.

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

## #70 2016-12-18 15:29:37

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,838
Website

### Re: Because he asked.

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

'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

## #71 2016-12-18 15:34:16

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

### Re: Because he asked.

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

## #72 2016-12-19 03:07:36

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,838
Website

### Re: Because he asked.

*her.

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

'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

## #73 2016-12-19 04:43:24

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

### Re: Because he asked.

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

## #74 2016-12-19 13:37:33

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,838
Website

### Re: Because he asked.

``````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]
];``````

'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

## #75 2016-12-19 13:38:33

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

### Re: Because he asked.

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