import java.awt.*; import java.applet.*; //copyright 2000 M Paez, U Antioquia, R landau, OSU public class Sqwell extends Applet implements Runnable { Thread runstring; private Image offScreenImage; double mxx,bxx,myy,byy,pi,k0,dx; double psr[][],psi[][],p2[]; int jj; int max; public void start() { if(runstring==null); { runstring=new Thread(this); runstring.start(); } } public void stop() { if(runstring != null){ runstring.stop(); runstring=null; } } public void run() { while(true){ repaint(); try{ Thread.sleep(10); } catch(InterruptedException e){ } } } public void update(Graphics g) { //To avoid flicker Graphics offScreenGraphics=offScreenImage.getGraphics(); offScreenGraphics.setColor(getBackground()); offScreenGraphics.fillRect(0,0,size().width,size().height); offScreenGraphics.setColor(g.getColor()); paint(offScreenGraphics); g.drawImage(offScreenImage,0,0,this); } void coormundo(double xiz,double ysu,double xde,double yinf) { double maxx,maxy,xxfin,xxcom,yyin,yysu; maxx=600; maxy=450; xxcom=0.15*maxx; xxfin=0.75*maxx; yyin=0.8*maxy; yysu=0.2*maxy; mxx=(xxfin-xxcom)/(xde-xiz); bxx=0.5*(xxcom+xxfin-mxx*(xiz+xde)); myy=(yyin-yysu)/(yinf-ysu); byy=0.5*(yysu+yyin-myy*(yinf+ysu)); } void ejes(double xmz,double yms,double xmd,double ymi,Graphics g) { //Grafica los ejes // La entrada esta en coordenadas 0.0 a 1.0 int i,mp,xpi,xpd,yps,ypi,xdiv,ydiv,ypcen; double yincr,xincr,yte; //char nhorz[3],nver[15]; char nver; int sig=4; ydiv=1; xpi=(int)(mxx*xmz+bxx); xpd=(int)(mxx*xmd+bxx); yps=(int)(myy*yms+byy); ypi=(int)(myy*ymi+byy); ypcen=(int)byy; g.drawLine(xpi,ypcen,xpd,ypcen); } public void Equation(Graphics g, int jj) { int peo,peye,pex,peyo; double dt,x,fact2; int i,n; dt=dx*dx; if(jj==1){ // initial conditions x=0.0; for(i=0;i1){ peo=(int)(mxx*(i-1)+bxx); peyo=(int)(myy*p2[i-1]+byy); pex=(int)(mxx*i+bxx); peye=(int)(myy*p2[i]+byy); g.drawLine(peo,peyo,pex,peye); } } } // new iterations are now the old ones for(i=1;i