(* For Lemma 2.1(iv)-- vector product analysis of the map. p and m at the end of the variable names indicate + and - resepectively *)

(* Lorentz inner prodcut *)

LDOT[VA_, VB_]:= VA[[1]]VB[[1]] + VA[[2]]VB[[2]] - VA[[3]]VB[[3]]

(*Lorentz metric matrix *)

IJ={{1, 0, 0}, {0, 1, 0}, {0, 0, -1}}

(* isometry acting on the line L_1 containing {0,0,1} and {1, 0, 0} *)

mA1[t_]:={{Cosh[t] , 0, Sinh[t]}, {0, 1, 0}, {Sinh[t], 0, Cosh[t]}}

(* The unit normal to the plane containing the two vertices V_- and V_+ on line L_2, Assume v2 >0 for convenience v3>0. Also, v2 much bigger than v3 since L_2 is close to L_1 *)

Vvec:={v1, v2,v3}

(* Cos(pi- theta_-), pi/2- theta_- = alpha_- angle at V_-*)

Cthetam:= LDOT[Vvec, {-1, 0, 0}]

(* Cos(pi- theta_+), pi/2 -theta_+ = alpha_+ angle at V_+*)

Cthetap:=LDOT[Vvec, mA1[l1].{1, 0, 0}]

(* Normal to the first geodesic *)

IJ.Cross[{0,0,1}, mA1[t].{0, 0,1}]

(* Lcross[Vec, (-1, 0, 0)] gives the first vertex where Vvec^perp and (-1, 0,0)^perp space meet. Multply by (-1) so that it is in the upper hyperboloid*)

Verm:= -(IJ.Cross[Vvec, {-1, 0, 0}])/Sqrt[-LDOT[Cross[Vvec, {-1, 0, 0}],Cross[Vvec, {-1, 0, 0}]]]

Simplify[Verm]

(* The (-1) cosh of the distance v1 to the axis= edge_- length, See Ratcliffe S.3.2 P. 64*)

(* ECm:=LDOT[(IJ.Cross[Vvec, {-1, 0, 0}]), {0, 0, 1}]/Sqrt[-LDOT[Cross[Vvec, {-1, 0, 0}],Cross[Vvec, {-1, 0, 0}]]]*)

ECm:=LDOT[Verm, {0, 0, 1}]

Simplify[ECm]

(* The (-1)cosh of the distance from Ver_+ to the axis= edge_+ length *)

(* Cross here give the second vertex Ver_+ where Vvec^perp and (mA1[l1].{0.0, 1})^perp meets *)

ECp:= LDOT[(IJ.Cross[Vvec, mA1[l1].{1, 0, 0}]), mA1[l1].{0, 0, 1}]/Sqrt[-LDOT[IJ.Cross[Vvec, mA1[l1].{1, 0, 0}],IJ.Cross[Vvec, mA1[l1].{1, 0, 0}]]]

Verp:= (IJ.Cross[Vvec, mA1[l1].{1, 0, 0}])/Sqrt[-LDOT[IJ.Cross[Vvec, mA1[l1].{1, 0, 0}],IJ.Cross[Vvec, mA1[l1].{1, 0, 0}]]]

Simplify[Verp]

Simplify[Cthetam]

Simplify[Cthetap]

(* ECm = -cosh e_- *)

Simplify[ECm]

(* ECp= -cosh e_+*)

Simplify[ECp]

EEm:= -(v2/(Sqrt[(v2^2)-(v3^2)]))

EEp:=- (v2/(Sqrt[(v2^2) ((Cosh[l1])^2)-(v2^2) ((Sinh[l1])^2)-(((v3 Cosh[l1]-v1 Sinh[l1]))^2)]))

Simplify[EEp]

(* Solve for Vvec from T1=x_-, T2=x_+ , xm Cosine of the angle at V_-, and xp Cosine of the angle at V_+*)

Solve[{xm==-v1, xp== v1 Cosh[l1]-v3 Sinh[l1]},{v1, v3}]

(* Now put the solution into EEm to get formula of EEm as functions of x1, x2 *)

Simplify[((-(v2/(Sqrt[(v2^2)-(v3^2)])))/.v2-> Sqrt[1- v1^2 + v3^2])/.{v1->-xm,v3->-xm Coth[l1]-xp Csch[l1]} ]

(*EE\m as a function of x_m, x_p *)

Eem[xm_, xp_]:=-((Sqrt[1-(xm^2)+(((xm Coth[l1]+xp Csch[l1]))^2)])/(Sqrt[1-(xm)^2]))

(* Now put the solution into EEp to get the formula of EEp as functions of x1 and x2 *)

Simplify[((((-v2)/(Sqrt[(v2^2) ((Cosh[l1])^2)-(v2^2) ((Sinh[l1])^2)-(((v3 Cosh[l1]-v1 Sinh[l1]))^2)])))/.v2-> Sqrt[1- v1^2 + v3^2])/.{v1->-xm,v3->-xm Coth[l1]-xp Csch[l1]} ]

(* EEp as a function of x1, x2 *)

Eep[xm_, xp_ ]:=-((Sqrt[1-(xm^2)+(((xm Coth[l1]+xp Csch[l1]))^2)])/(Sqrt[1-(xp^2)]))

(*EEm, EEp are the same up to switching x1 and x2 and switching EE1 and EE2 Just by thinking of them as relabeling -- It is easy to verify by hand using hyperbolic trig identitites*)

(* ArcCosh manual input-- Need to get the distances e_-, e_+*)

(* The (-1) needed. See Ratcliffe S.3.2 P. 64*)

AC[z_]:= Log[z+ Sqrt[z+1]Sqrt[z-1]]

Simplify[ExpandAll[AC[-Eem[xm, xp]]]]

(* partially simplify *)

Simplify[(-1+((Sqrt[1-(xm^2)+(xm^2) ((Coth[l1])^2)+2 xm xp Coth[l1] Csch[l1]+(xp^2) ((Csch[l1])^2)])/(Sqrt[1-(xm^2)])) )(1+((Sqrt[1-(xm^2)+(xm^2) ((Coth[l1])^2)+2 xm xp Coth[l1] Csch[l1]+(xp^2) ((Csch[l1])^2)])/(Sqrt[1-(xm^2)])))]

Simplify[ExpandAll[AC[-Eep[xm, xp]]]]

FullSimplify[(-1+((Sqrt[1-(xm^2)+(xm^2) ((Coth[l1])^2)+2 xm xp Coth[l1] Csch[l1]+(xp^2) ((Csch[l1])^2)])/(Sqrt[1-(xp^2)])) )(1+((Sqrt[1-(xm^2)+(xm^2) ((Coth[l1])^2)+2 xm xp Coth[l1] Csch[l1]+(xp^2) ((Csch[l1])^2)])/(Sqrt[1-(xp^2)])))]

(* Coth[1], csch[1], arcsin, The following are numberical estimations we need for Lemma 2.1 *)

N[Coth[1]]

N[Csch[1]]

ArcSin[1/(8 * 2.18)]

ArcSin[1/(8*2.18)]/(1/(8*2.18))

(3/2)*(2.18)

3.27*(1.00056)

N[Coth[1]^2-1]

N[Exp[1]-1]