import java.applet.Applet; import java.awt.event.*; import java.awt.*; public class Energy { /**This is the basic routine. It computes the quantity 1/d^e, where d is the E3-distance between the vectors V1 and V2. **/ public static double interaction(double e,Vector V1,Vector V2) { double d=Vector.dist(V1,V2); d=Math.pow(d,-e); return(d); } /**This routine computes the total energy of 4 points in the plane, plus the point at infinity. These 4 points are mapped stereographically to the unit sphere, and the vector (0,0,1) is included as the image of infinity. */ public static double energy(double e,Complex[] z) { Vector[] V=new Vector[5]; for(int i=0;i<4;++i) V[i]=Stereo.inverseStereo(z[i]); V[4]=new Vector(0,0,1); double total=0; for(int i=0;i<5;++i) { for(int j=i+1;j<5;++j) { total=total+interaction(e,V[i],V[j]); } } return(total); } /**This is the energy lower bound based on the distance upper bound from the paper**/ public static double energyLowerBound(double e,Box B1,Box B2) { double dist=Separation.psiMax(B1,B2); double t=Math.pow(dist,-e); return(t); } /**This is a formula for the energy of the TBP**/ public static double minEnergy(double E) { double y=Math.pow(.5,E)+6*Math.pow(.5,E/2)+3*Math.pow(1.0/3.0,E/2); return(y); } /**This is used in the tetrahedral eliminator**/ public static double tetrahedralComplement(double E) { double e1=minEnergy(E); double e2=6*Math.pow(3.0/8.0,E/2); double t=e1-e2; return(t); } }