Files
@ 29857512e53b
Branch filter:
Location: AENC/switchchain/triangle_exponent_plots.m - annotation
29857512e53b
2.6 KiB
application/vnd.wolfram.mathematica.package
Add triangle creation frequency histogram plots
ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 68c5df4ebb15 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 68c5df4ebb15 68c5df4ebb15 68c5df4ebb15 68c5df4ebb15 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 68c5df4ebb15 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 ba07c5475997 68c5df4ebb15 68c5df4ebb15 68c5df4ebb15 68c5df4ebb15 | (* ::Package:: *)
Needs["ErrorBarPlots`"]
(* ::Section:: *)
(*Triangle exponent*)
(* ::Text:: *)
(*Expected number of triangles is the following powerlaw*)
(* ::DisplayFormula:: *)
(*#triangles = const\[Cross]n^(T(\[Tau])) where T(\[Tau])=3/2 (3-\[Tau])*)
(* When importing from exponent-only-data file *)
gsraw=Import[NotebookDirectory[]<>"data/graphdata_exponent_mix32.m"];
gsraw=SortBy[gsraw,#[[1,1]]&]; (* Sort by n *)
averagesGrouped=GatherBy[gsraw,{#[[1,2]]&,#[[1,1]]&}];
(* averagesGrouped[[ tau index, n index, run index , {ntau, avgtri} ]] *)
nlabels=Map["n = "<>ToString[#]&,averagesGrouped[[1,All,1,1,1]]];
taulabels=Map["tau = "<>ToString[#]&,averagesGrouped[[All,1,1,1,2]]];
averagesErrorBars=Map[
{{#[[1,1,1]],Mean[#[[All,2]]]},
ErrorBar[StandardDeviation[#[[All,2]]]]
}&,averagesGrouped,{2}];
ErrorListPlot[averagesErrorBars,Joined->True,PlotMarkers->Automatic,PlotRange->All,AxesLabel->{"n","\[LeftAngleBracket]triangles\[RightAngleBracket]"},PlotLegends->taulabels]
ListLogLogPlot[averagesErrorBars[[All,All,1]],Joined->True,PlotMarkers->Automatic,AxesLabel->{"n","\[LeftAngleBracket]triangles\[RightAngleBracket]"},PlotLegends->taulabels]
(* ::Subsection:: *)
(*Fitting the log-log-plot*)
loglogdata=Log[averagesErrorBars[[All,All,1]]];
fits=Map[Fit[#,{1,logn},logn]&,loglogdata];
fitsExtra=Map[LinearModelFit[#,logn,logn]&,loglogdata];
fitsExtra[[1]]["ParameterConfidenceIntervalTable"]
fitsExtra[[1]]["BestFitParameters"]
fitsExtra[[1]]["ParameterErrors"]
fitsExtra[[1]]["ParameterConfidenceIntervals"]
plot1=Show[ListLogLogPlot[averagesErrorBars[[All,All,1]],Joined->False,PlotMarkers->Automatic,AxesLabel->{"n","\[LeftAngleBracket]triangles\[RightAngleBracket]"},PlotLegends->taulabels],Plot[fits,{logn,1,2000}]]
Export[NotebookDirectory[]<>"plots/avgtris_n.pdf",plot1]
(* ::Subsection:: *)
(*Plot of T(\[Tau])*)
tauValues=averagesGrouped[[All,1,1,1,2]];
exponents=Transpose[{tauValues,fits[[All,2,1]]}];
Show[ListPlot[exponents,Joined->True,PlotMarkers->Automatic,AxesLabel->{"tau","exponent"},PlotRange->{{2,3},{0,1.6}}],Plot[3/2(3-tau),{tau,2,3}]]
(* ::Subsection:: *)
(*T(\[Tau]) including error bars*)
tauValues=averagesGrouped[[All,1,1,1,2]];
exponentsErrorBars=Map[{{#[[1]],#[[2]]["BestFitParameters"][[2]]},ErrorBar[#[[2]]["ParameterConfidenceIntervals"][[2]]-#[[2]]["BestFitParameters"][[2]]]}&,
Transpose[{tauValues,fitsExtra}]];
plot2=Show[ErrorListPlot[exponentsErrorBars,Joined->True,PlotMarkers->Automatic,Frame->True,FrameLabel->{"tau","triangle exponent"},PlotRange->{{2,3},{0,1.6}},ImageSize->300],Plot[3/2(3-tau),{tau,2,3},PlotStyle->{Dashed}]]
Export[NotebookDirectory[]<>"plots/triangle_exponent.pdf",plot2]
|