import java.awt.*; import java.lang.Math; import java.util.Random; public class inf extends java.applet.Applet implements Runnable { Thread runner; Image offscreenImg; Graphics offscreen; Canvas canvas; Label Nlabel, esizelabel, speedlabel, scalelabel, noiselabel, epslabel; TextField Ntf, esizetf, speedtf, scaletf, noisetf, epstf; int Nmax = 100; int numcolors = 128; Color colortab[] = new Color[numcolors]; int colorindex[] = new int[Nmax*Nmax]; Color bgColor; int sleeptime = 25; // Milliseconds // tau = 1 assumed double speed = 1.01; // I double scale = 1.; double noise = 0.3; double eps = .000; int elemSize = 25; int width, height; int canvas_width; int canvas_height; int N = 5; int NN=N*N; double phi[] = new double[Nmax*Nmax]; double rhs[] = new double[Nmax*Nmax]; double out[] = new double[Nmax*Nmax]; public void init() { int i; Random r = new Random(); double v; bgColor = new Color( .85f, .85f, 0.f ); colortab[0] = new Color(1.f, 0.f, 0.f ); for (i=1; i 1 for (i=0; i1.) { out[i] = 1.; phi[i] = 0.; } else out[i] = 0.; } // we don't want delays, so redistribute spikes and fire again for (i=0; i1.) { out[i] = 1.; phi[i] = 0.; } else out[i] = 0.; } // compute new colors for (i=0; i=3. && newValue < Nmax) N = (int)newValue; NN = N*N; } numberFormatError = false; try { dval = Double.valueOf(esizetf.getText()); } catch (NumberFormatException e) { numberFormatError = true; } if ( numberFormatError == false) { newValue = dval.doubleValue(); if (newValue >=1. && newValue <= 100.) elemSize = (int)newValue; } numberFormatError = false; try { dval = Double.valueOf(speedtf.getText()); } catch (NumberFormatException e) { numberFormatError = true; } if ( numberFormatError == false) { newValue = dval.doubleValue(); if (newValue >=0 && newValue <= 100) speed = newValue; } numberFormatError = false; try { dval = Double.valueOf(scaletf.getText()); } catch (NumberFormatException e) { numberFormatError = true; } if ( numberFormatError == false) { newValue = dval.doubleValue(); if (newValue >=0 && newValue < (N-1)) scale = newValue; } numberFormatError = false; try { dval = Double.valueOf(noisetf.getText()); } catch (NumberFormatException e) { numberFormatError = true; } if ( numberFormatError == false) { newValue = dval.doubleValue(); if (newValue >=0 && newValue <= 100) noise = newValue; } numberFormatError = false; try { dval = Double.valueOf(epstf.getText()); } catch (NumberFormatException e) { numberFormatError = true; } if ( numberFormatError == false) { newValue = dval.doubleValue(); if (newValue >=0 && newValue <= 100) eps = newValue; } return true; } else if (evt.target instanceof Button) { int i; Random r = new Random(); double v; // initialize to random values for (i=0; i