(*I used this file when debugging the java code for the
polynomials in SymmPoly2.java.   The way it works is that
you set the variables sign and choice:

sign can be    0 or 1
choice can be  0 or 1

Then you enter the file into mathematica and look at the
polynomials TRA and DET.  These should match the
corresponding polynomials produced by the Java program.
*)


(*inverse stereographic projection*)
s[x_, y_] := {(2*x)/(1 + x*x + y*y), (2*y)/(1 + x*x + y*y), 1 - 2/(1 + x*x + y*y)};


f[x1_,y1_,ss_]:=Power[2 - 2 s[x1,y1].{0,0,1},-ss];

g[x1_,y1_,x2_,y2_]:=Power[2-2 s[x1,y1].s[x2,y2],-1];

Clear[a,b,c,d,t1,t2,t3,t4];

sign=0;
choice=1;


a=  (416 (1-t1) + 498 t1)/512;
b=  16 t2/512;
c=  If[choice==0,(348 (1-t3) +465 t3)/512,(364 (1-t3)+449 t3)/512]
d=  If[choice==0,24 t4/512,64 t4/512];
d=  (2 sign-1) d;



BASIC=g[a,b,0,-c+d] + g[a,b,0,c+d] - 2 g[a,0,0,c];
POLY=BASIC +  b b/94 +d d/13;


NUM=Numerator[Together[ExpandAll[POLY]]]
DEN=Numerator[Together[ExpandAll[POLY]]]

TRA=Expand[D[NUM,{t2,2}]+D[NUM,{t4,2}]]
DET=Expand[D[NUM,{t2,2}] D[NUM,{t4,2}] - D[D[NUM,t2],t4] D[D[NUM,t2],t4]]