import java.applet.Applet; import java.awt.*; import java.awt.event.*; import java.applet.*; import java.awt.geom.*; import java.math.*; /**This class is only implemented for the exponents e=1 and e=2.**/ public class IntervalEnergyEstimator { /**1 means eliminate.*/ public static int eliminate(Interval e2,double E,IntervalBoxConfiguration X) { Interval e1=energyLowerBound(E,X); if(e1.l>e2.r) return(1); return(0); } /**Here is the main energy estimate. The second number tells which index makes the biggest contribution to the error term.**/ public static Interval energyLowerBound(double E,IntervalBoxConfiguration X) { Interval e1=vertexEnergy(E,X); Interval e2=errorTerm(E,X); Interval t=Interval.minus(e1,e2); return(t); } /**This routine computes the energy at the 128 vertices of a dyadic box and then takes the min.**/ public static Interval vertexEnergy(double E,IntervalBoxConfiguration X) { double min=10000000; Interval test=new Interval(0.0); IntervalComplex[] Z=new IntervalComplex[4]; for(int n=0;n<128;++n) { Z=X.getConfiguration(n); test=IntervalEnergy.energy(E,Z); if(min>test.l) min=test.l; } return(new Interval(min)); } /**Here is the error term. This follows the notation in the paper.**/ public static Interval errorTerm(double E, IntervalBoxConfiguration X) { Interval total=new Interval(0.0); Interval test=new Interval(0,0); for(int i=0;i<4;++i) { test=errorTermSingleIndex(E,X,i); total=Interval.plus(total,test); } return(total); } /**For an individual index **/ public static Interval errorTermSingleIndex(double E, IntervalBoxConfiguration X,int i) { Interval total=new Interval(0.0); Interval d=X.B[i].delta(); for(int j=0;j<5;++j) { if(j!=i) { total=Interval.plus(total,Interval.times(Interval.times(d,d),epsilon(E,X.B[i],X.B[j]))); } } return(total); } /**epsilon from the paper**/ public static Interval epsilon(double E,IntervalBox B1,IntervalBox B2) { Interval R=IntervalSeparation.psiMin(B1,B2); if(R.l<=0) return(new Interval(Math.pow(2,50))); Interval l1=lambda1(E,B1,B2,R); Interval l2=lambda2(E,B1,B2,R); l1=Interval.max(new Interval(0.0),l1); Interval l3=Interval.plus(l1,l2); return(l3); } /**lambda 1 from the paper**/ public static Interval lambda1(double e,IntervalBox B1,IntervalBox B2,Interval R) { Interval E0=new Interval(e); Interval ONE=new Interval(1.0); Interval E1=Interval.plus(E0,ONE); Interval E2=Interval.plus(E1,ONE); Interval R0=new Interval(); if(e<1.5) R0=new Interval(R); //R if(e>1.5) R0=Interval.times(R,R); //R^2 Interval R2=new Interval(); if(e<1.5) R2=Interval.times(Interval.times(R,R),R); //R^3 if(e>1.5) R2=Interval.times(Interval.times(R,R),Interval.times(R,R)); //R^4 if(B1.type==0) { Interval t1=Interval.divide(Interval.times(E0,E1),Interval.times(new Interval(4.0),R2)); Interval t2=Interval.divide(Interval.times(E0,E2),Interval.times(new Interval(16.0),R0)); Interval t=Interval.minus(t1,t2); return(t); } if(B1.type<1.5) { Interval t1=Interval.divide(Interval.times(E0,E1),Interval.times(new Interval(8.0),R2)); Interval t2=Interval.divide(Interval.times(E0,E2),Interval.times(new Interval(32.0),R0)); Interval t=Interval.minus(t1,t2); return(t); } return(new Interval(0.0)); } /**lambda2 from the paper. **/ public static Interval lambda2(double e,IntervalBox B1,IntervalBox B2,Interval R) { Interval E=new Interval(e); if(B1.type==1) { Interval R1=new Interval(); if(e<1.5) R1=Interval.times(R,R); //R^2 if(e>1.5) R1=Interval.times(Interval.times(R,R),R); //R^3 Interval t=Interval.divide(E,Interval.times(new Interval(8.0),R1)); return(t); } if(B1.type==0) { Interval R1=new Interval(); if(e<1.5) R1=Interval.times(R,R); //R^2 if(e>1.5) R1=Interval.times(Interval.times(R,R),R); //R^3 Interval ONE=new Interval(1.0); Interval t0=Interval.divide(E,Interval.times(new Interval(7.98),R1)); Interval x1=B1.xAbsMax(); Interval y1=B1.yAbsMax(); Interval t1=Interval.sqrt(Interval.plus(ONE,Interval.times(x1,x1))); Interval t2=Interval.sqrt(Interval.plus(ONE,Interval.times(y1,y1))); Interval t=Interval.times(t0,Interval.plus(t1,t2)); return(t); } return(new Interval(0.0)); } }