Class NormalModes

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----java.awt.Applet
                                   |
                                   +----Edu.calpoly.math.gepstein.NormalModes

public class NormalModes
extends Applet
implements Runnable
This applet shows the first eight contributing normal modes of string with fixed ends. This is equivalent to two identical traveling waves moving in opposite directions.

The wave equation: Wave Equation

Boundary Conditions: First boundary Condition

Second boundary Condition

Initial Condition: Wave Equation

Initial Condition: Wave Equation

Originally Written in TRUE Basic for Macintosh by Dr. G.M. Epstein
Copyright © 1997, 1998 by Dr. G.M. Epstein

gepstein@calpoly.edu

Author:
Gary M. Epstein

Constructor Index

 o NormalModes()

Method Index

 o aTerms(int)
Calculates the coefficients for the Fourier series.
 o fourier(int, double, double)
Calculates the value of a harmonic in the equation: for different times t and different locations x.
 o init()
This method sets the frame refresh rate for the animation, the background color, the amount of space the animation occupies in the the WWW browser and how much space each individual contributing wave will occupy in the total area.
 o linearTransform(double, int)
Takes a value from the conventional cartesian coordinate system and translates it to the coordinate system in a single panel on our display
 o paint(Graphics)
This method simply passes the current graphics context to the update() method.
 o run()
The Java Virtual Machine calls this method just after completing the start() method.
 o start()
If the user has not requested that we stop the animation with a mouse click, this method begins animation following initial program loading, the user revisting the WWW page or de-iconifying the browser.
 o stop()
Stops the animation.
 o update(Graphics)
This method does the computation and displays the graphical results on the screen.

Constructors

 o NormalModes
 public NormalModes()

Methods

 o init
 public void init()
This method sets the frame refresh rate for the animation, the background color, the amount of space the animation occupies in the the WWW browser and how much space each individual contributing wave will occupy in the total area.

Overrides:
init in class Applet
 o start
 public void start()
If the user has not requested that we stop the animation with a mouse click, this method begins animation following initial program loading, the user revisting the WWW page or de-iconifying the browser. If the user did request that we stop the motion, this method does nothing.

Overrides:
start in class Applet
See Also:
stop
 o run
 public void run()
The Java Virtual Machine calls this method just after completing the start() method. This method begins another thread running concurrently, the thread handling the animation. Calls the paint() method on regular intervals in order to continue the animation.

See Also:
run in class Thread
 o paint
 public void paint(Graphics g)
This method simply passes the current graphics context to the update() method.

Overrides:
paint in class Container
See Also:
update
 o update
 public void update(Graphics g)
This method does the computation and displays the graphical results on the screen.

Overrides:
update in class Container
See Also:
paint
 o stop
 public void stop()
Stops the animation. In the case of the user leaving the web page or minimizing the browser, the JVM calls this method so that the animation won't continue running and taking CPU time without anyone to see it.

Overrides:
stop in class Applet
See Also:
start
 o aTerms
 public float aTerms(int n)
Calculates the coefficients for the Fourier series:
Collapsed form of the equation
where:
Fourier equation

Parameters:
n - the number of the harmonic.
Returns:
the value of the n-th coefficient.
 o fourier
 public double fourier(int n,
                       double x,
                       double t)
Calculates the value of a harmonic in the equation: Fourier equation
for different times t and different locations x.

Parameters:
n - the number of the harmonic
x - the current location on the x-axis
t - the elapsed time since the start of the animation
Returns:
the value of the n-th harmonic.
 o linearTransform
 public int linearTransform(double yValue,
                            int mid)
Takes a value from the conventional cartesian coordinate system and translates it to the coordinate system in a single panel on our display

Parameters:
yValue - vertical value in the canonical cartesian coordinate system
mid - value halfway between 0 and the maximum vertical coordinate
Returns:
the value of yValue in the AWT coordinate system