import java.awt.*; import java.applet.*; public class Mandel_Finder extends Applet{ double aa=2.0,xx=0.0,yy=0.0; public void paint(Graphics g){ int hx,hy; double a=aa/4; double x=0.0-xx; double y=0.0-yy; double zr,zi,z,p,r,hz; for(double j=-1.0/a+y;j<1.0/a+y;j=j+0.005/a){ for(double i=-1.0/a+x;i<1.0/a+x;i=i+0.005/a){ hx=(int)(200-200*x*a+i*200*a); hy=(int)(200-200*y*a+j*200*a); hz=(int)(Math.round((1000/3)*(Math.log(a))/(Math.log(10))+500)); zr=0;zi=0; for(int k=0;k<=hz;k++){ z=zr*zr-zi*zi+i; p=2*zr*zi+j; r=z*z+p*p; if(r>=4&&k<=hz){ g.setColor(new Color((int)(125*Math.round(Math.sin(15*3.14*(k*3-90)/180)+1)), (int)(125*Math.round(Math.sin(15*3.14*k*3/180)+1)), (int)(125*Math.round(Math.sin(15*3.14*(k*3+90)/180)+1)))); g.fillRect(hx,hy,1,1); break; }else if(r<4&&k==hz){ g.setColor(new Color(0,0,0)); g.fillRect(hx,hy,1,1); break; } zr=z;zi=p; } } } } public boolean mouseDown(Event e,int dx,int dy){ xx=(200-dx)/(aa*100)+xx; yy=(200-dy)/(aa*100)+yy; aa=aa+aa; repaint(); return true; } }