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

You are not logged in.

## #1926 2013-09-28 13:16:49

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

### Re: Is this cool with you?

Recursion in my opinion is rarely the best way to go.

It performs well for the tasks it is given. The lists are rarely longer than 50 and usually shorter.

When we begin you will see why this program is more than fast enough. But if you want to optimize it then go ahead.

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

## #1927 2013-09-28 19:38:43

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,030

### Re: Is this cool with you?

Okay, what now?

Here lies the reader who will never open this book. He is forever dead.
Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

## #1928 2013-09-28 21:49:55

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

### Re: Is this cool with you?

Hi;

Make a table:

s=Table[Sum[1/n^3, {n, 1, 2^m}], {m, 0, 17}]

That is really stupid code!

s//N

{1., 1.125, 1.177662037037037, 1.1951602435617104, \
1.2002220387226148, 1.2015836423576125, 1.2019367252957784, \
1.2020266230687449, 1.202049303509178, 1.2020549995326137, \
1.20205642678787, 1.2020567840084981, 1.2020568733645467, \
1.2020568957099231, 1.202056901297063, 1.2020569026939472, \
1.2020569030431807}

Using the double rule we can see that we probably have about 8 places.

Now run

N[romberg[s], 50]

1.2020569031595942853997381615114499907649857486888

we see we have about 41 places! A great acceleration.

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

## #1929 2013-09-30 06:26:19

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,030

### Re: Is this cool with you?

Hi

Here's my code for romberg:

``````romberg[l_] := Module[{x, a}, a = Dimensions[l][[1]]; x = 1/2;
Clear[f];
f[n_, 1] := f[n, 1] = l[[n]];
f[i_, j_] := f[i, j] = (f[i, j - 1] - x^(j - 1)*f[i - 1, j - 1])/(1 - x^(j - 1));
f[a, a]];``````

Hm, let me try it on another one.

Here lies the reader who will never open this book. He is forever dead.
Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

## #1930 2013-09-30 06:33:48

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

### Re: Is this cool with you?

Did you write 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

## #1931 2013-09-30 06:36:00

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,030

### Re: Is this cool with you?

Write what?

Here lies the reader who will never open this book. He is forever dead.
Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

## #1932 2013-09-30 06:39:52

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

### Re: Is this cool with you?

That Romberg or all of Shakespeare?

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

## #1933 2013-09-30 06:44:12

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,030

### Re: Is this cool with you?

I wrote the romberg function. Why?

Here lies the reader who will never open this book. He is forever dead.
Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

## #1934 2013-09-30 06:46:46

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

### Re: Is this cool with you?

That is good. Did you get the point of it in post 1928?

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

## #1935 2013-09-30 06:48:31

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,030

### Re: Is this cool with you?

Hi

I did. I tried it on both of our accelerated sequences, and it worked worse than on the original sequence...

If you were wondering about the stuff I used, like f[i,j]:=f[i,j]=...; it's something I found a while ago while searching for a way to do memoization in recursion in M.

Last edited by anonimnystefy (2013-09-30 06:49:44)

Here lies the reader who will never open this book. He is forever dead.
Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

## #1936 2013-09-30 06:56:39

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

### Re: Is this cool with you?

Yes, I am familiar with memoization.

What do you mean by worse?

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

## #1937 2013-09-30 07:00:20

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,030

### Re: Is this cool with you?

``````Table[Sum[(11 i + 6)/(i^3 (i + 1) (i + 2) (i + 3)), {i, 1, n}], {n, 1, 50}];

N[romberg1[%], 30]
0.785389896574820021713652114058

5/12 + % - Zeta[3]
-3.39918107597019419380786*10^-7``````

Last edited by anonimnystefy (2013-09-30 07:01:25)

Here lies the reader who will never open this book. He is forever dead.
Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

## #1938 2013-09-30 07:10:18

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

### Re: Is this cool with you?

Sequence acceleration has rules and the tail does not apply.

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

## #1939 2013-09-30 07:11:27

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,030

### Re: Is this cool with you?

Could you elaborate?

Here lies the reader who will never open this book. He is forever dead.
Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

## #1940 2013-09-30 07:13:11

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

### Re: Is this cool with you?

Notice how I constructed s.

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

## #1941 2013-09-30 07:16:23

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

### Re: Is this cool with you?

Sequences that are decreasing geometrically and have steep curves seem to accelerate better. The tail is almost flat.

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

## #1942 2013-09-30 07:16:49

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,030

### Re: Is this cool with you?

Oh! It goes from 1 to 2^m. I didn't see that one. Sorry! I am getting it now. Thanks!

Here lies the reader who will never open this book. He is forever dead.
Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

## #1943 2013-09-30 07:18:21

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

### Re: Is this cool with you?

The point is we only needed a couple of terms to get 41 digits. Continuing that table would have required about 10^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

## #1944 2013-09-30 07:24:27

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,030

### Re: Is this cool with you?

Yeah, I know. It's a good one. Only about 130 000 is much more doable.

Here lies the reader who will never open this book. He is forever dead.
Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

## #1945 2013-09-30 07:25:55

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

### Re: Is this cool with you?

Romberg is working fine for about 50 digits but for 100 or so another idea is necessary.

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

## #1946 2013-09-30 08:02:39

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,030

### Re: Is this cool with you?

What do you suggest then?

Here lies the reader who will never open this book. He is forever dead.
Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

## #1947 2013-09-30 08:08:39

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

### Re: Is this cool with you?

I tried shanks, it did not work.

There are 3 areas open yet. Winjgaarden transformation,Euler Mclaurin and the new accelerator I 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

## #1948 2013-09-30 08:42:30

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,030

### Re: Is this cool with you?

Does any of them work on this one?

Here lies the reader who will never open this book. He is forever dead.
Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

## #1949 2013-09-30 09:15:50

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

### Re: Is this cool with you?

I do not know yet, as soon as I finish another problem I will start on this one.

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

## #1950 2013-10-01 12:06:32

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

### Re: Is this cool with you?

Hi anonimnystefy;

A simple idea is to make use of the fact:

it is now easy to get 100+ digits.

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