In[]:=
Needs["SubKernels`LocalKernels`"]Block[{$mathkernel=$mathkernel<>" -threadpriority=2"},LaunchKernels[]]
Out[]=
{KernelObject[1,local],KernelObject[2,local],KernelObject[3,local],KernelObject[4,local],KernelObject[5,local],KernelObject[6,local],KernelObject[7,local],KernelObject[8,local],KernelObject[9,local],KernelObject[10,local],KernelObject[11,local],KernelObject[12,local],KernelObject[13,local],KernelObject[14,local],KernelObject[16,local],KernelObject[18,local],$Failed}
In[]:=
ClearAll[RootPade6,expM,MRB1,MRB2,err,goodDigits];RootPade6[n_Integer,prec_Integer]:=Module[{x,pc,z,t,N0=n,A1,A2,A3,B1,B2},(*Padécoefficientsfordegree[3/2]*)A1=3(2N0+1)/(5N0);A2=3(N0+1)(2N0+1)/(20N0^2);A3=(N0+1)(2N0+1)/(60N0^3);B1=2(3N0-1)/(5N0);B2=(2N0-1)(3N0-1)/(20N0^2);(*initialseed*)x=N[N0^(1/N0),prec/8/6/4];pc=Precision[x];While[pc<prec,pc=Min[6pc,prec];(*6xprecisioneachstep*)x=SetPrecision[x,pc];t=x^N0;z=(N0-t)/t;(*residualforx^n=n*)(*6th-orderiteration:r_{i+1}=r_iR_N(z)*)x=x*(1+A1z+A2z^2+A3z^3)/(1+B1z+B2z^2);];N[x,prec]];pr=2000;steps=1;expM[pre_Integer,alpha_?NumericQ]:=Module[{d,bb,cc,s,n,pr2,block,start,stop,rng,xvals,ctab,m,dot},pr2=Floor[1.005pre];n=Floor[alphapr2];block=Ceiling[n/steps];Print["Iterations required: ",n];d=N[ChebyshevT[n,3],pr2+50];bb=SetPrecision[-1,pr2+50];cc=-d;s=SetPrecision[0,pr2+50];start=1;While[start<=n,stop=Min[start+block-1,n];Print["Starting block ",start," to ",stop];rng=Range[start,stop];(*RootPade6replacementforExp[Log[rng]/rng]-1*)xvals=ParallelTable[N[RootPade6[k,pr2]-1,pr2],{k,start,stop}];ctab=Table[cc=bb-cc;m=start+j-2;bb*=2(m+n)(m-n)/((m+1)(2m+1));cc,{j,1,stop-start+1}];dot=ctab.xvals;If[Dimensions[dot]=!={},Print["ERROR: dot is not scalar."];Print["Head[dot] = ",Head[dot]];Print["Dimensions[dot] = ",Dimensions[dot]];Abort[];];s+=dot;Print[stop," iterations done."];start=stop+1;];N[-s/d,pre]];Print["Computing MRB1..."];Print["The first run took this many seconds:",AbsoluteTiming[MRB1=expM[pr,1.32]][[1]]];Print["Computing MRB2..."];Print["the second run took this many seconds:",AbsoluteTiming[MRB2=expM[pr,1.34]][[1]]];If[ValueQ[MRB1]&&ValueQ[MRB2],err=N[Abs[MRB2-MRB1],50];Print["Error estimate = ",ScientificForm[err,20]];goodDigits=If[NumericQ[err]&&err>0,Floor[-Log10[err]],"at least "<>ToString[pr]];Print["Estimated good digits = ",goodDigits],Print["MRB1 or MRB2 failed; no valid error estimate."]];Print[pr," digits are ",MRB2];
Computing MRB1...
Iterations required: 2651
Starting block 1 to 2651
2651 iterations done.
The first run took this many seconds:0.153068
Computing MRB2...
Iterations required: 2692
Starting block 1 to 2692
2692 iterations done.
the second run took this many seconds:0.141578
Error estimate = 0.×
-2000
10
Estimated good digits = at least 2000
2000 digits are 0.18785964246206712024851793405427323005590309490013878617200468408947723156466021370329665443310749690384234585625801906123137009475922663043892934889618412083733662608161360273812637937343528321255276396217148932170207628206217151671540841268044836354167199851976802527598938993914457983505561350964852107120784442309586812949768852694956420425558648367044104252795247106066609263397483410311578167864166891546003422225883800254553968929471142122189105098328712277308020036445215390536395055332203470627551159812828039510219264914673176293516190659816018664245824950697203381992958420935515162514399357600764593291281451709082424915883204169066409334435914806705564692806787007028115009380606938139385953360657987405562062348704329360737819564603104763950664893061360645528067515193508280837376719296866398103094949637496277383049846324563479311575300289212523291816195626973697074865765476071178017195787368300965902260668753656305516567361288150201438756136686552210674305370591039735756191489093690777983203551193362404637253494105428363699717024418551654837279358822008134480961058802030647819619596953756287834812334976385863010140727252923014723333362509185840248037040488819676767601198581116791693527968520441600270861372286889451015102919988536905728659287086875425492533794395347589703563313440382638887986656195980733514739902565778133172261076127975852722742777308985774922305970962572562718836755752978879253616876739403543214513627725492293131262764357321446216187786377154205423128223446295396532903322171479820280759842210655648900485368587070832688748773776350476891609831855362816671591084121934201643860002585084265564350069548328301205461932051559350400235083512613359217408970073297842771289673651619602250771173880842623256978854653786904622270856748747470930693573266685908561628237538655124329756474649146191795758693429962081498785366631701972645342604683780107590551486787190395783150604524441907570445113820585333984692194828794764865759317859581652749297782209597744091137
In[]:=
10/14.
Out[]=
0.714286
In[]:=
1/7.
Out[]=
0.142857