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=5000;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: 6631
Starting block 1 to 6631
6631 iterations done.
The first run took this many seconds:0.739094
Computing MRB2...
Iterations required: 6732
Starting block 1 to 6732
6732 iterations done.
the second run took this many seconds:0.752979
Error estimate = 0.×
-5000
10
Estimated good digits = at least 5000
5000 digits are 0.18785964246206712024851793405427323005590309490013878617200468408947723156466021370329665443310749690384234585625801906123137009475922663043892934889618412083733662608161360273812637937343528321255276396217148932170207628206217151671540841268044836354167199851976802527598938993914457983505561350964852107120784442309586812949768852694956420425558648367044104252795247106066609263397483410311578167864166891546003422225883800254553968929471142122189105098328712277308020036445215390536395055332203470627551159812828039510219264914673176293516190659816018664245824950697203381992958420935515162514399357600764593291281451709082424915883204169066409334435914806705564692806787007028115009380606938139385953360657987405562062348704329360737819564603104763950664893061360645528067515193508280837376719296866398103094949637496277383049846324563479311575300289212523291816195626973697074865765476071178017195787368300965902260668753656305516567361288150201438756136686552210674305370591039735756191489093690777983203551193362404637253494105428363699717024418551654837279358822008134480961058802030647819619596953756287834812334976385863010140727252923014723333362509185840248037040488819676767601198581116791693527968520441600270861372286889451015102919988536905728659287086875425492533794395347589703563313440382638887986656195980733514739902565778133172261076127975852722742777308985774922305970962572562718836755752978879253616876739403543214513627725492293131262764357321446216187786377154205423128223446295396532903322171479820280759842210655648900485368587070832688748773776350476891609831855362816671591084121934201643860002585084265564350069548328301205461932051559350400235083512613359217408970073297842771289673651619602250771173880842623256978854653786904622270856748747470930693573266685908561628237538655124329756474649146191795758693429962081498785366631701972645342604683780107590551486787190395783150604524441907570445113820585333984692194828794764865759317859581652749297782209597744091137143421692962459317532453734012995939950049179129836808485471439258467042385286083200536645105866781511964596760791964317343076715344983004971288694016566004270621110790531647215045563299438840052111523901687731154569610283692050368961088060316036603828965332393835241545101375341656734726074648911200880998381520466954150263770355732835929966306427173051589721163519991611359546703154087252872439981978725027467973886388970568674353778579810585561924921857169491356734627040774914487996820654828174658806422363481607809507770579393134958298066028252721284916888092303252902700599177550596158359199931908693930397366116465148582199729253371067687386862350479158797379682698478780822234106187896746674506800644040655538752132814949807002098581322206201090112659034497174108010632475647128346095492843700651474502182261204156439303088598264262568281260924911367339672359337145342169025601400501694699838759073429203617293015314004059362464067814007794756130773697324099235294647945807781646076962408645956660841411263999885757394293152262838987984363507193714865734919620254284435104114728419738149338070662225731910214815857450428867284772504343867184431491289486354489294921432596608471496000725340662153875613413252542741301581824766364321115068094774514063091609280297193276067969468609263620817634422729775463267371611103022200194984554072338596799729567453184904338263329318881603300540136903161043099737778639343931356214965499699373142058190653346615738352222808713909343313252383603052871723148111510297058562812995589918303810719663081327016704986176831683295290537987600306665702034358849603421048114886812160836119446055719139732929706832326450945715371702023251751982208521511884275346588918121726603331928048011747590461318984497207220682489191539332580026246272161764244687477896097649060704796053517402052279920211128765398353817401179552670033758313960788477267092157001428248335741882127065588260757223843468364254606243762949725572084429109010146920322976340088313403816403729113113149598830486629449645321931135749564539123854566628815660998603254478398628780147569772281911518615208276282401455651794253838186194793399401497599872404273885056441143756079520211579102553987653665393231584920065329570705591855222675428457368126706995658246747621115995677988710899431291034014425497659371352169077892867695205556979383621955999138096214465028267844577751983335618744957998843531990905504564240610916094297513674772622513506116867915294536437177399139221264837788062038727680883810322672849330859390787727347282725262001885607446549531438327158297381955786656871622816760083907552694743377480542717093388979753170189068955143939404845538298301981692536597974767785468650458596402381759301399961226676681173896705020332923490805136900674702817092565211984795692028584777685609789206862143074015933425777262910166752349405574100207286898501479277429106643136941528199585609819765232162553186237642605913206671239423983107480089006769757060713233301249195951646813480370178134651913158679