(* ::Package:: *)
(* ::Section:: *)
(*P(Z^n | start 011..11) on the chain {1,...,n}*)
rawdata=Import[NotebookDirectory[]<>"data/data_reach_chain_end.m"];
data=GatherBy[rawdata,{#[[2]]}&];
(* data[[n index, prob index, p / n / prob / runs within timelimit / total runs]] *)
nlabels=Map["n = "<>ToString[#[[1,2]]]&,data];
plotZoomed=ListPlot[data[[All,All,{1,3}]],
Joined->True,
PlotMarkers->Automatic,
PlotRange->{{0.6,0.7},{0,0.5}},
Frame->True,
ImageSize->250,
Epilog->{Dashed,Line[{{1-1/E,0},{1-1/E,1}}]}
];
plotBoth=ListPlot[data[[All,All,{1,3}]],
Joined->True,
FrameLabel->{"p (probability of BAD)","P(\!\(\*SuperscriptBox[\(Z\), \(n\)]\) | start 011..11)"},
PlotMarkers->Automatic,
PlotLegends->nlabels,
PlotRange->{{0,1},{0,1}},
Frame->True,
ImageSize->500,
Epilog->Inset[plotZoomed,Scaled[{0.32,0.6}]]]