package Current.plot.Dyadic; import Current.*; import Current.basic.*; import java.applet.Applet; import java.awt.event.*; import java.awt.*; public class Certify { public Certify() {} /*****CERFIFICATE*****/ /*the goal of this routine is to tell if the gradient of a function, as it varies over a square in the parameter space, lies in a quadrant. The values (grad1,grad2) give the gradient at the center of the point. The terms (b1,b2) are bounds on the 2nd derivatives. These bounds guarantee that: grad1-bb1*r < grad1(x) 0)&&(grad1-b1>0)) x[1]=1; if((grad2+b2>0)&&(grad2-b2>0)) x[2]=1; if((grad1+b1<0)&&(grad1-b1<0)) x[3]=1; if((grad2+b2<0)&&(grad2-b2<0)) x[4]=1; if((x[1]>0)&&(x[2]>0)) return(1); if((x[2]>0)&&(x[3]>0)) return(3); if((x[3]>0)&&(x[4]>0)) return(5); if((x[4]>0)&&(x[1]>0)) return(7); //standard quadrant test has failed. //now we look at a square twice as //large and try to show that the gradient //lies in some quadrant. step=Math.PI*Math.pow(0.5,k+1); //twice square radius a1=Math.max(a[0],a[1]); a2=Math.max(a[1],a[2]); b1=step*a1; b2=step*a2; x[1]=grad1+b1; x[2]=grad2+b2; x[3]=grad1-b1; x[4]=grad2-b2; x[5]=Math.abs(x[1]); if(x[5]x[5])&&( x[4]>x[5])) return(2); if((-x[1]>x[6])&&(-x[3]>x[6])) return(4); if((-x[2]>x[5])&&(-x[4]>x[5])) return(6); if(( x[1]>x[6])&&( x[3]>x[6])) return(8); return(0); } }