(* Code for calculating the Fredholm determinant for the pinball problem *)
Get["orbits.m"]
t[n_] := Exp[s Tp[n]] z^np[n]/Abs[lam[n]]
B[p_,r_] := -t[p]^r/(r (1-lam[p]^(-r))^2)
logFred = Series[Sum[Sum[B[p,r] , {r,1,Floor[7/np[p]]}], {p,0,40}],
	{z,0,7}]
Fred = Exp[logFred]
gamma[m_] := Block[{fred1},
	  fred1 = Normal[Series[Fred, {z,0,m}]] /.z->1;
	  N[s /. FindRoot[fred1==0, {s, 0.4}], 16]
	]
gam = Table[gamma[i], {i,1,6}]
Print["Escape rate = ", gam]Save["tmp.dat", Fgam]
fred1 = Fred /. s -> gamma[6]
Plot[Evaluate[Normal[fred1]], {z, -100, 100}]
ListPlot[Log[Abs[fred1[[3]]]]]

