I finally came up with my very own program to calculate digits of the MRB constant which is sometimes faster than Richard Crandall's!!!!
The notebook is attached. Here it is with results of 10,000 digits in 7.5 s and 20,000 digits in 34.0 s:
Print[ "Start time is ", ds = DateString[], "."];
prec = 10000;
(**Number of required decimals.*.*)ClearSystemCache[];
T0 = SessionTime[];
expM[pre_] :=
Module[{a, d, s, k, bb, c, end, iprec, xvals, x, pc, cores = 16(*=4*
number of physical cores*), tsize = 2^7, chunksize, start = 1, ll,
ctab, pr = Floor[1.0002 pre]}, chunksize = cores*tsize;
n = Floor[1.32 pr];
end = Ceiling[n/chunksize];
Print["Iterations required: ", n];
Print["Will give ", end,
" time estimates, each more accurate than the previous."];
Print["Will stop at ", end*chunksize,
" iterations to ensure precsion of around ", pr,
" decimal places."]; d = ChebyshevT[n, 3];
{b, c, s} = {SetPrecision[-1, 1.1*n], -d, 0};
iprec = pr/2^6;
Do[xvals = Flatten[ParallelTable[Table[ll = start + j*tsize + l;
x = N[E^(Log[ll]/(ll)), iprec];
pc = iprec;
While[pc < pr, pc = Min[4 pc, pr];
x = SetPrecision[x, pc];
xll = x^ll; z = (ll - xll)/xll;
t = 2 ll - 1; t2 = t^2;
x =
x*(1 + SetPrecision[4.5, pc] (ll - 1)/
t2 + (ll + 1) z/(2 ll t) -
SetPrecision[13.5,
2 pc] ll (ll - 1)/ (3 ll t2 + t^3 z))];(**N[Exp[Log[
ll]/ll],pr]**)
x, {l, 0, tsize - 1}], {j, 0, cores - 1},
Method ->
"EvaluationsPerKernel" ->
16(*a power of 2 commensurate with available RAM*)]];
ctab = ParallelTable[Table[c = b - c;
ll = start + l - 2;
b *= 2 (ll + n) (ll - n)/((ll + 1) (2 ll + 1));
c, {l, chunksize}],
Method ->
"EvaluationsPerKernel" ->
16(*a power of 2 commensurate with processor strength*)];
s += ctab.(xvals - 1);
start += chunksize;
st = SessionTime[] - T0; kc = k*chunksize;
ti = (st)/(kc + 10^-10)*(n)/(3600)/(24);
If[kc > 1,
Print[kc, " iterations done in ", N[st - stt, 4], " seconds.",
" Should take ", N[ti, 4], " days or ", ti*3600*24,
"s, finish ", DatePlus[ds, ti], "."],
Print["Denominator computed in " , stt = st, "s."]];, {k, 0,
end - 1}];
N[-s/d, pr]];
t2 = Timing[MRBtest2 = expM[prec];]; Print["Finished on ",
DateString[], ". Processor and total time were ",
t2[[1]], " and ", st, " s respectively."];
(*Print[*)MRBtest2(*]*)(*Remove (**) or enter MRBtest2 to print \
output*); Print["Enter MRBtest2 to print ",
Floor[Precision[
MRBtest2]], " digits"]; Print["If you saved m3M, the difference \
between this and 3,014,991 known digits is ", N[MRBtest2 - m3M, 10]]
Start time is Sun 6 May 2018 08:45:42.
Iterations required: 13202
Will give 7 time estimates, each more accurate than the previous.
Will stop at 14336 iterations to ensure precsion of around 10002 decimal places.
Denominator computed in 1.1155632s.
2048 iterations done in 1.081 seconds. Should take 0.0001639 days or 14.156946s, finish Sun 6 May 2018 08:45:56.
4096 iterations done in 2.166 seconds. Should take 0.0001224 days or 10.577535s, finish Sun 6 May 2018 08:45:52.
6144 iterations done in 3.277 seconds. Should take 0.0001092 days or 9.438089s, finish Sun 6 May 2018 08:45:51.
8192 iterations done in 4.377 seconds. Should take 0.0001025 days or 8.852246s, finish Sun 6 May 2018 08:45:50.
10240 iterations done in 5.443 seconds. Should take 0.00009787 days or 8.4555849s, finish Sun 6 May 2018 08:45:50.
12288 iterations done in 6.453 seconds. Should take 0.00009412 days or 8.1320232s, finish Sun 6 May 2018 08:45:50.
Finished on Sun 6 May 2018 08:45:50. Processor and total time were 6.46875 and 7.5690275 s respectively.
Enter MRBtest2 to print 9997 digits
If you saved m3M, the difference between this and 3,014,991 known digits is 0.*10^-9998
Print[ "Start time is ", ds = DateString[], "."];
prec = 20000;
(**Number of required decimals.*.*)ClearSystemCache[];
T0 = SessionTime[];
expM[pre_] :=
Module[{a, d, s, k, bb, c, end, iprec, xvals, x, pc, cores = 16(*=4*
number of physical cores*), tsize = 2^7, chunksize, start = 1, ll,
ctab, pr = Floor[1.0002 pre]}, chunksize = cores*tsize;
n = Floor[1.32 pr];
end = Ceiling[n/chunksize];
Print["Iterations required: ", n];
Print["Will give ", end,
" time estimates, each more accurate than the previous."];
Print["Will stop at ", end*chunksize,
" iterations to ensure precsion of around ", pr,
" decimal places."]; d = ChebyshevT[n, 3];
{b, c, s} = {SetPrecision[-1, 1.1*n], -d, 0};
iprec = pr/2^6;
Do[xvals = Flatten[ParallelTable[Table[ll = start + j*tsize + l;
x = N[E^(Log[ll]/(ll)), iprec];
pc = iprec;
While[pc < pr, pc = Min[4 pc, pr];
x = SetPrecision[x, pc];
xll = x^ll; z = (ll - xll)/xll;
t = 2 ll - 1; t2 = t^2;
x =
x*(1 + SetPrecision[4.5, pc] (ll - 1)/
t2 + (ll + 1) z/(2 ll t) -
SetPrecision[13.5,
2 pc] ll (ll - 1)/ (3 ll t2 + t^3 z))];(**N[Exp[Log[
ll]/ll],pr]**)
x, {l, 0, tsize - 1}], {j, 0, cores - 1},
Method ->
"EvaluationsPerKernel" ->
16(*a power of 2 commensurate with available RAM*)]];
ctab = ParallelTable[Table[c = b - c;
ll = start + l - 2;
b *= 2 (ll + n) (ll - n)/((ll + 1) (2 ll + 1));
c, {l, chunksize}],
Method ->
"EvaluationsPerKernel" ->
16(*a power of 2 commensurate with processor strength*)];
s += ctab.(xvals - 1);
start += chunksize;
st = SessionTime[] - T0; kc = k*chunksize;
ti = (st)/(kc + 10^-10)*(n)/(3600)/(24);
If[kc > 1,
Print[kc, " iterations done in ", N[st - stt, 4], " seconds.",
" Should take ", N[ti, 4], " days or ", ti*3600*24,
"s, finish ", DatePlus[ds, ti], "."],
Print["Denominator computed in " , stt = st, "s."]];, {k, 0,
end - 1}];
N[-s/d, pr]];
t2 = Timing[MRBtest2 = expM[prec];]; Print["Finished on ",
DateString[], ". Processor and total time were ",
t2[[1]], " and ", st, " s respectively."];
(*Print[*)MRBtest2(*]*)(*Remove (**) or enter MRBtest2 to print \
output*); Print["Enter MRBtest2 to print ",
Floor[Precision[
MRBtest2]], " digits"]; Print["If you saved m3M, the difference \
between this and 3,014,991 known digits is ", N[MRBtest2 - m3M, 10]]
Start time is Sun 6 May 2018 08:47:31.
Iterations required: 26405
Will give 13 time estimates, each more accurate than the previous.
Will stop at 26624 iterations to ensure precsion of around 20004 decimal places.
Denominator computed in 2.4963526s.
2048 iterations done in 2.541 seconds. Should take 0.0007518 days or 64.951484s, finish Sun 6 May 2018 08:48:35.
4096 iterations done in 5.093 seconds. Should take 0.0005662 days or 48.923174s, finish Sun 6 May 2018 08:48:19.
6144 iterations done in 7.744 seconds. Should take 0.0005094 days or 44.010388s, finish Sun 6 May 2018 08:48:15.
8192 iterations done in 10.26 seconds. Should take 0.0004759 days or 41.118632s, finish Sun 6 May 2018 08:48:12.
10240 iterations done in 12.81 seconds. Should take 0.0004567 days or 39.460971s, finish Sun 6 May 2018 08:48:10.
12288 iterations done in 15.33 seconds. Should take 0.0004434 days or 38.312869s, finish Sun 6 May 2018 08:48:09.
14336 iterations done in 17.99 seconds. Should take 0.0004368 days or 37.741573s, finish Sun 6 May 2018 08:48:08.
16384 iterations done in 20.77 seconds. Should take 0.0004340 days or 37.498549s, finish Sun 6 May 2018 08:48:08.
18432 iterations done in 23.49 seconds. Should take 0.0004309 days or 37.230689s, finish Sun 6 May 2018 08:48:08.
20480 iterations done in 26.12 seconds. Should take 0.0004270 days or 36.8938561s, finish Sun 6 May 2018 08:48:07.
22528 iterations done in 28.75 seconds. Should take 0.0004238 days or 36.6182626s, finish Sun 6 May 2018 08:48:07.
24576 iterations done in 31.48 seconds. Should take 0.0004225 days or 36.5068233s, finish Sun 6 May 2018 08:48:07.
Finished on Sun 6 May 2018 08:48:05. Processor and total time were 28.1563 and 33.9780984 s respectively.
Enter MRBtest2 to print 19998 digits
If you saved m3M, the difference between this and 3,014,991 known digits is 0.*10^-20000
UPDATE
Having a little trouble with the accuracy of my very own program with 30,000 digits and more. And as I start to fix the accuracy problem my program's benchmarks, vs those of Crandall's, begin to fall. I'm just glad to have gotten my very own program to work as good as it does! I'll probably come back to it later.
For now, thinking I will stick with Crandall's program for future records.
My next big step will be adding a matching 2400 MH DDR4 16 GB DIMM to my new quad core's single "Dual Ranked" DIMM . Hopefully that will speed up my timings!
My great goal in those timings was to calculate 7000 accurate digits in 3.6 second or less. I chose 7000 digits because one of my first records set in 2003, mentioned in the first post of this discussion, was to calculate roughly 7000 digits in a 10 hour period.
3.6 seconds represents a 10,000 fold increase in total MRB constant technology:
10 hours*(3600 s/hours)/(3.6 s)
= 10,000.
Here is my present timing for around 7,000 accurate digits (2.53 s):
Mathematica 11.3.0 Kernel for Microsoft Windows (64-bit)
Copyright 1988-2018 Wolfram Research, Inc.
In[1]:= (*Newer loop with Newton interior.*)prec = 5000;(*Number of required \
decimals.*)expM[pr_] := Module[{a, d, s, k, b, c}, n = Floor[1.32 pr];
Print["Iterations required: ", n];
d = N[(3 + Sqrt[8])^n, pr + 10];
d = Round[1/2 (d + 1/d)];
{b, c, s} = {-1, -d, 0};
T0 = SessionTime[];
Do[c = b - c;
x = N[E^(Log[k + 1]/(k + 1)), iprec = Ceiling[prec/128]];
pc = iprec;
Do[nprec = Min[2 pc, pr];
x = SetPrecision[x, nprec];(*Adjust precision*)
x = N[x - x/(k + 1) + 1/x^k, nprec];
pc *= 2;
If[nprec >= pr, Break[]], {ct, 1, 19}];
s += c*(x - 1);
b *= 2 (k + n) (k - n)/((k + 1) (2 k + 1));
If[Mod[k, 1000] == 0,
Print["Iterations: ", k, " Cumulative time (sec): ",
SessionTime[] - T0];], {k, 0, n - 1}];
N[-s/d, pr]];
In[2]:=
In[2]:= MRBtest2 = expM[prec]
Iterations required: 6600
Iterations: 0 Cumulative time (sec): 0.0009972
Iterations: 1000 Cumulative time (sec): 0.3650443
Iterations: 2000 Cumulative time (sec): 0.7619830
Iterations: 3000 Cumulative time (sec): 1.1828568
Iterations: 4000 Cumulative time (sec): 1.6226791
Iterations: 5000 Cumulative time (sec): 2.0654949
Iterations: 6000 Cumulative time (sec): 2.5262617
I got my very own program to work to many differing ammounts of digits, finally!
It is now a little slower than Crandall's program, but uses only my 4th order convergence (4 digits per iteration) interior instead of Crandall's 3rd order. Here it is:
Print[ "Start time is ", ds = DateString[], "."];
prec =15000;
ClearSystemCache[];
T0 = SessionTime[];
expM[pre_] :=
Module[{a, d, s, k, bb, c, end, iprec, xvals, x, pc, cores = 16, tsize = 2^7, chunksize, start = 1, ll,
ctab, pr = Floor[7000/6795 pre]}, chunksize = cores*tsize;
n = Floor[1.32 pr];
end = Ceiling[n/chunksize];
Print["Iterations required: ", n];
Print["Will give ", end,
" time estimates, each more accurate than the previous."];
Print["Will stop at ", end*chunksize,
" iterations to ensure precsion of around ", pr,
" decimal places."]; d = ChebyshevT[n, 3];
{b, c, s} = {SetPrecision[-1, 1.1*n], -d, 0};
iprec = pr/2^6;
Do[xvals = Flatten[ParallelTable[Table[ll = start + j*tsize + l;
x = N[E^(Log[ll]/(ll)), iprec];
pc = iprec;
While[pc < pr, pc = Min[4 pc, pr];
x = SetPrecision[x, pc];
xll = x^ll; z = (ll - xll)/xll;
t = 2 ll - 1; t2 = t^2;
x =
x*(1 + SetPrecision[4.5, pc] (ll - 1)/
t2 + (ll + 1) z/(2 ll t) -
SetPrecision[13.5,
2 pc] ll (ll - 1)/ (3 ll t2 + t^3 z))];
x, {l, 0, tsize - 1}], {j, 0, cores - 1},
Method ->
"EvaluationsPerKernel" ->
16]];
ctab = ParallelTable[Table[c = b - c;
ll = start + l - 2;
b *= 2 (ll + n) (ll - n)/((ll + 1) (2 ll + 1));
c, {l, chunksize}],
Method ->
"EvaluationsPerKernel" ->
16];
s += ctab.(xvals - 1);
start += chunksize;
st = SessionTime[] - T0; kc = k*chunksize;
ti = (st)/(kc + 10^-10)*(n)/(3600)/(24);
If[kc > 1,
Print[kc, " iterations done in ", N[st - stt, 4], " seconds.",
" Should take ", N[ti, 4], " days or ", ti*3600*24,
"s, finish ", DatePlus[ds, ti], "."],
Print["Denominator computed in " , stt = st, "s."]];, {k, 0,
end - 1}];
N[-s/d, pr]];
t2 = Timing[MRBtest2 = expM[prec];]; Print["Finished on ",
DateString[], ". Processor and total time were ",
t2[[1]], " and ", st, " s respectively."];
MRBtest2; Print["Enter MRBtest2 to print ",
Floor[Precision[
MRBtest2]], " digits"]; Print["If you saved m3M, the difference \
between this and 3,014,991 known digits is ", N[MRBtest2 -m7k, 10]]
Use this link to use it on the Wolfram cloud.
https://www.wolframcloud.com/objects/bmmmburns/published/All MRB
Attachments: