In[]:=
Off[General::spell1];(*--------------------------------------------*)(*--------------------------------------------*)(*http://library.wolfram.com/infocenter/MathSource/4738/*)GWR[F_,t_,M_:32,precin_:0]:=Module[{M1,G0,Gm,Gp,best,expr,τ=Log[2]/t,Fi,broken,prec},If[precin<=0,prec=21M/10,prec=precin];If[prec<=$MachinePrecision,prec=$MachinePrecision];broken=False;If[Precision[τ]<prec,τ=SetPrecision[τ,prec]];Do[Fi[i]=N[F[iτ],prec],{i,1,2M}];M1=M;Do[G0[n-1]=τ(2n)!/(n!(n-1)!)Sum[Binomial[n,i](-1)^iFi[n+i],{i,0,n}];If[Not[NumberQ[G0[n-1]]],M1=n-1;G0[n-1]=.;Break[]];,{n,1,M}];Do[Gm[n]=0,{n,0,M1}];best=G0[M1-1];Do[Do[expr=G0[n+1]-G0[n];If[Or[Not[NumberQ[expr]],expr==0],broken=True;Break[]];expr=Gm[n+1]+(k+1)/expr;Gp[n]=expr;If[OddQ[k],If[n==M1-2-k,best=expr]];,{n,M1-2-k,0,-1}];If[broken,Break[]];Do[Gm[n]=G0[n];G0[n]=Gp[n],{n,0,M1-k}];,{k,0,M1-2}];best]SetAttributes[GWR,{Listable,NHoldAll}](*--------------------------------------------*)(*--------------------------------------------*)PF[s_]:=1/s/Sqrt[s+1];(*--------------------------------------------*)ndigits=150;ndigitswork=100;ndigitsout=30;(*--------------------------------------------*)(*InverseLaplaceTransformofPF[t]*)Pinv[t_]:=If[t<0,0,GWR[PF,t,ndigits]];(*--------------------------------------------*)pstart=0;pstep=10^-4;pend=(π/4);(*--------------------------------------------*)strm=OpenWrite["output.txt"]SetOptions[strm,PageWidth->300]Block[{$MaxExtraPrecision=400},For[p=pstart,p<pend,p=p+pstep,Res=If[p==0,1,FindRoot[Pinv[p*r]==((2/Sqrt[π])*Sqrt[p]),{r,2},WorkingPrecision->ndigitswork][[1]][[2]]];ResAnal=If[p==0,1,(InverseErf[(2/Sqrt[π])*Sqrt[p]]^2)/p];Rerror=Res/ResAnal-1;Prec=Precision[Res];Mem=MemoryInUse[];Write[strm,CForm[N[p,ndigitsout]],OutputForm[" "],CForm[N[Res,ndigitsout]],OutputForm[" "],CForm[N[Rerror,ndigitsout]],OutputForm[" "],OutputForm[Prec],OutputForm[" "],OutputForm[Mem]];Clear[Res,ResAnal,Rerror,Prec,Mem]]]Close[strm](*--------------------------------------------*)
Out[]=
OutputStream
Out[]=
{BinaryFormatFalse,FormatTypeInputForm,PageWidth300,PageHeight22,TotalWidth∞,TotalHeight∞,CharacterEncodingAutomatic,NumberMarks$NumberMarks,Method{File,BinaryFormatFalse}}
Out[]=
output.txt