diff --git a/triangle_canonical_mixingtime.m b/triangle_canonical_mixingtime.m index 08f52fab664f79e78f60d1b5a0117648398ddca5..542bbb0a3d715960df30a4debf1de7155d1a790c 100644 --- a/triangle_canonical_mixingtime.m +++ b/triangle_canonical_mixingtime.m @@ -1,6 +1,6 @@ (* ::Package:: *) -gsraw=Import[NotebookDirectory[]<>"data/graphdata_canonical_mixingtime_histogram.m"]; +gsraw=Import[NotebookDirectory[]<>"data/graphdata_canonical_mixingtime_histogram_merged.m"]; gdata=GatherBy[gsraw,{#[[1,2]]&}]; (* Data format: *) (* gdata[[ tau index, n index, datatype index ]] *) @@ -48,9 +48,10 @@ FrameLabel->{"triangles","probability"} ], ListPlot[normalize[run[[3]]],Joined->True,PlotRange->plotrange,PlotLegends->Placed[{"uniform"},Scaled[{0.7,0.7}]],PlotStyle->{Thick,Black}]]] -plot1=makeHistogram[gdata[[1,-1]],{{3500,7800},{0,0.005}},{10,50,100}] -plot2=makeHistogram2[gdata[[3,-1]],{{50,300},{0,0.04}},{10,20,30}] -plot3=makeHistogram2[gdata[[5,-1]],{{0,70},{0,0.18}},{5,10,20}] +plot1=makeHistogram[gdata[[1,5]],{{3500,7800},{0,0.005}},{10,50,100}] +plot2=makeHistogram2[gdata[[3,5]],{{50,300},{0,0.04}},{10,20,30}] +plot3=makeHistogram2[gdata[[5,5]],{{0,70},{0,0.18}},{5,10,20}] +plot4=makeHistogram[gdata[[1,-1]],Automatic,{50,100,150,200}] Export[NotebookDirectory[]<>"plots/triangle_distributions_over_time.pdf",plot2] @@ -79,8 +80,10 @@ m=Min[hist1[[1,1]],hist2[[1,1]]]; M=Max[hist1[[-1,1]],hist2[[-1,1]]]; probs=ConstantArray[0,M-m+1]; probs1=hist1[[All,2]]; +(* probs1=GaussianFilter[probs1,10]; (* test *) *) probs1=probs1/Total[probs1]; probs2=hist2[[All,2]]; +(* probs2=GaussianFilter[probs2,10]; (* test *) *) probs2=probs2/Total[probs2]; probs[[1+hist1[[1,1]]-m;;1+hist1[[-1,1]]-m]]+=probs1; probs[[1+hist2[[1,1]]-m;;1+hist2[[-1,1]]-m]]-=probs2; @@ -105,18 +108,20 @@ ratios=Map[getRatios,gdata,{2}]; (*Map[ListPlot[#[[All,2]],Joined->True,PlotMarkers->Automatic,PlotRange->(1+{-0.15,+0.15}),PlotLegends->#[[All,1]],ImageSize->300]&,ratios]*) (*Map[ListPlot[#[[All,3]],Joined->True,PlotMarkers->Automatic,PlotRange->(0+{-1,+1}),PlotLegends->#[[All,1]],ImageSize->300]&,ratios]*) *) -getTVDs[run_]:=Module[{scalefactor}, -scalefactor=1/(run[[1,1]]*Log[2,run[[1,1]]]^(1*(4-run[[1,2]]))); -{"\[Tau] = "<>ToString[run[[1,2]]], -Map[{#[[1]]*scalefactor,getTVDistance2[#[[2]],run[[3]]]}&,run[[2]]]} +getTVDs[run_]:=Module[{scaling}, +scaling[step_,n_,tau_]:=step/(n*Log[n]^(4-tau)); +{"n = "<>ToString[run[[1,1]]],"\[Tau] = "<>ToString[run[[1,2]]], +Map[{scaling[#[[1]],run[[1,1]],run[[1,2]]],getTVDistance2[#[[2]],run[[3]]]}&,run[[2]]]} ] TVDs=Map[getTVDs,gdata,{2}]; -Map[Show[ListPlot[#[[All,2]], +Map[Show[ListPlot[#[[All,3]], Joined->True,(*PlotMarkers->Automatic,*) -PlotLegends->#[[All,1]],ImageSize->500, -PlotRange->{0,1},Frame->True,FrameLabel->{"steps / (n (\!\(\*SubscriptBox[\(log\), \(2\)]\)n\!\(\*SuperscriptBox[\()\), \(4 - \[Tau]\)]\))","TV distance"}], +PlotLegends->Placed[#[[All,1]],Center],ImageSize->500, +PlotRange->{0,1},Frame->True,FrameLabel->{"steps / (n (\!\(\*SubscriptBox[\(log\), \(2\)]\)n\!\(\*SuperscriptBox[\()\), \(4 - \[Tau]\)]\))","TV distance"}, +PlotLabel->#[[1,2]] +], Plot[{0.1,0.05},{x,0,20},PlotStyle->Directive[Black,Dashed]] ]&,TVDs] @@ -139,8 +144,9 @@ While[i<=Length[run[[2]]], mixingtimes=Map[getMixingTime,gdata,{2}]; -scaling[n_,tau_]:=n*Log[n]^(4-tau); +scaling[n_,tau_]:=n*Log[2,n]^(4-tau); scaling[n_,tau_]:=n; +scaling[n_,tau_]:=n*Log[2,n]^1.5; plotData=Map[{#[[1]],#[[4]]/scaling[#[[1]],#[[2]]]}&,mixingtimes,{2}]~Join~Map[{#[[1]],#[[3]]/scaling[#[[1]],#[[2]]]}&,mixingtimes,{2}]; fillings={1->{6},2->{7},3->{8},4->{9},5->{10}}; taulabels=Map["\[Tau] = "<>ToString[#[[1,2]]]&,mixingtimes];