Esempio n. 1
0
 /**
  * Constructs OscillatorsMode with the given mode and number of particles.
  *
  * <p>The particle separation is one in this model.
  *
  * @param mode int
  * @param N int
  */
 OscillatorsMode(int mode, int N) {
   amplitude = Math.sqrt(2.0 / (N + 1));
   omega = 2 * Math.sqrt(OMEGA_SQUARED) * Math.abs(Math.sin(mode * Math.PI / N / 2));
   wavenumber = Math.PI * mode / (N + 1);
   functionDrawer = new FunctionDrawer(this);
   functionDrawer.initialize(0, N + 1, 300, false); // draws the initial displacement
   functionDrawer.color = Color.LIGHT_GRAY;
 }
Esempio n. 2
0
 /**
  * Draws the normal mode's initial condtion
  *
  * @param panel DrawingPanel
  * @param g Graphics
  */
 public void draw(DrawingPanel panel, Graphics g) {
   functionDrawer.draw(panel, g);
 }