diff --git a/triangle_etmt_plots.m b/triangle_etmt_plots.m index 2c341f6f6d0dd3c1968f34a290475808e17af321..2b0cfbcb1fa4a83fae478a78b5653fb1d06ac06d 100644 --- a/triangle_etmt_plots.m +++ b/triangle_etmt_plots.m @@ -3,7 +3,7 @@ Needs["ErrorBarPlots`"] -gsraw=Import[NotebookDirectory[]<>"data/graphdata_etmt_partial.m"]; +gsraw=Import[NotebookDirectory[]<>"data/graphdata_etmt.m"]; (* gsraw=SortBy[gsraw,{#[[1,1]]&,#[[1,2]]&}]; (* Sort by n and then by tau. The {} forces a *stable* sort because otherwise Mathematica sorts also on triangle count and other things. *) *) @@ -14,17 +14,34 @@ gdata=GatherBy[gsraw,{#[[1,2]]&,#[[1,1]]&}]; 1: {n,tau} 2: etmt *) +tauvalues=gdata[[All,1,1,1,2]]; nlabels=Map["n = "<>ToString[#]&,gdata[[1,All,1,1,1]]]; taulabels=Map["\[Tau] = "<>ToString[#]&,gdata[[All,1,1,1,2]]]; +etmtMean=Map[Mean[N[#[[All,2]]]]&,gdata,{2}]; +etmtSD=Map[StandardDeviation[N[#[[All,2]]]]&,gdata,{2}]; +etmtQuantile=Map[Quantile[#[[All,2]],99/100]&,gdata,{2}]; + + histograms=Map[Histogram[#[[All,2]]]&,gdata,{2}]; -histogramsWithLine=Map[Histogram[#[[All,2]],Epilog->Line[{{Mean[N[#[[All,2]]]]+StandardDeviation[N[#[[All,2]]]],0},{Mean[N[#[[All,2]]]]+StandardDeviation[N[#[[All,2]]]],500}}]]&,gdata,{2}]; +histogramsWithLines=MapIndexed[ +Histogram[#[[All,2]],PlotRange->All, +Epilog->Line[{ +{{etmtMean[[#2/.List->Sequence]],0}, +{etmtMean[[#2/.List->Sequence]],500}}, +{{etmtMean[[#2/.List->Sequence]]+etmtSD[[#2/.List->Sequence]],0}, +{etmtMean[[#2/.List->Sequence]]+etmtSD[[#2/.List->Sequence]],500}}, +{{etmtQuantile[[#2/.List->Sequence]],0}, +{etmtQuantile[[#2/.List->Sequence]],500}} +}] +] +&,gdata,{2}]; -TableForm[histograms,TableHeadings->{taulabels,nlabels}] +TableForm[histogramsWithLines,TableHeadings->{taulabels,nlabels}] gdataSwitched=Transpose[gdata]; @@ -39,17 +56,37 @@ Export[NotebookDirectory[]<>"plots/ETMTdistribution.pdf",combiHistograms[[9]]] mixingTimesBars=Map[{{#[[1,1,1]],Mean[#[[All,2]]]},ErrorBar[StandardDeviation[#[[All,2]]]]}&,gdata,{2}]; +mixingTimesQuantiles=Map[{#[[1,1,1]],Quantile[#[[All,2]],99/100]}&,gdata,{2}]; -ErrorListPlot[mixingTimesBars[[{1,2,3,5,8}]],Joined->True,PlotMarkers->Automatic,Frame->True,FrameLabel->{"n","ETMT"},PlotLegends->taulabels] +plot1=ErrorListPlot[mixingTimesBars[[{1,2,3,5,8}]],Joined->True,PlotMarkers->Automatic,Frame->True,FrameLabel->{"n","ETMT"},PlotLegends->taulabels]; +plot2=ListPlot[mixingTimesQuantiles[[{1,2,3,5,8}]],Joined->True,PlotMarkers->Automatic,Frame->True,FrameLabel->{"n","ETMT"},PlotLegends->taulabels]; +Show[plot2,plot1] mixingTimesDivN=Map[{#[[1,1]],#[[1,2]]/(#[[1,1]])}&,mixingTimesBars,{2}]; mixingTimesDivNlogN=Map[{#[[1,1]],#[[1,2]]/(#[[1,1]]*Log[#[[1,1]]])}&,mixingTimesBars,{2}]; +etmtQuantileDivN=Map[{#[[1]],#[[2]]/(#[[1]])}&,mixingTimesQuantiles,{2}]; +etmtQuantileDivNlogN=Map[{#[[1]],#[[2]]/(#[[1]]*Log[#[[1]]])}&,mixingTimesQuantiles,{2}]; plotN=ListPlot[mixingTimesDivN,Joined->True,PlotMarkers->Automatic,Frame->True,FrameLabel->{"n","\[LeftAngleBracket]ETMT\[RightAngleBracket]/n"},PlotLegends->taulabels,ImageSize->300] plotNlogN=ListPlot[mixingTimesDivNlogN,Joined->True,PlotMarkers->Automatic,Frame->True,FrameLabel->{"n","\[LeftAngleBracket]ETMT\[RightAngleBracket]/(n log n)"},PlotLegends->taulabels,ImageSize->300] +plotQuantileN=ListPlot[etmtQuantileDivN,Joined->True,PlotMarkers->Automatic,Frame->True,FrameLabel->{"n","q(ETMT,99%)/n"},PlotLegends->taulabels,ImageSize->300] +plotQuantileNlogN=ListPlot[etmtQuantileDivNlogN,Joined->True,PlotMarkers->Automatic,Frame->True,FrameLabel->{"n","q(ETMT,99%)/(n log n)"},PlotLegends->taulabels,ImageSize->300] Export[NotebookDirectory[]<>"plots/ETMTdivN.pdf",plotN] + + +etmtQuantileDivNmax=Map[Max[#[[All,2]]]&,etmtQuantileDivN]; +etmtQuantileDivNmax=Transpose[{tauvalues,etmtQuantileDivNmax}]; + +mixingTimesDivNmax=Map[Max[#[[All,2]]]&,mixingTimesDivN]; +mixingTimesDivNmax=Transpose[{tauvalues,mixingTimesDivNmax}]; + + +Show[ +Plot[{(50-30(tau-2)),32-26(tau-2)},{tau,2,3},AxesOrigin->{2,0}], +ListPlot[{etmtQuantileDivNmax,mixingTimesDivNmax},Joined->True,PlotMarkers->Automatic,PlotRange->{{2,3},All}] +]