org.opensourcephysics.sip.ch01
Class SHOModel

java.lang.Object
  extended by org.opensourcephysics.display.Circle
      extended by org.opensourcephysics.sip.ch01.SHOModel
All Implemented Interfaces:
Drawable, ODE

public class SHOModel
extends Circle
implements ODE

SHOModel defines a damped simple harmonic oscillator using a system of first order differential equations.


Field Summary
 
Fields inherited from class org.opensourcephysics.display.Circle
color, pixRadius, x, y
 
Constructor Summary
SHOModel()
           
 
Method Summary
 void getRate(double[] state, double[] rate)
          Calculates the rate array using the given state.
 double[] getState()
          Gets the state array.
 void move()
          Moves the particle.
 
Methods inherited from class org.opensourcephysics.display.Circle
draw, getLoader, getX, getY, setX, setXY, setY, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SHOModel

public SHOModel()
Method Detail

getState

public double[] getState()
Gets the state array.

Specified by:
getState in interface ODE
Returns:
an array containing {x, v, t}

getRate

public void getRate(double[] state,
                    double[] rate)
Calculates the rate array using the given state. Values in the rate array are overwritten.

Specified by:
getRate in interface ODE
Parameters:
state - the state
rate - the rate

move

public void move()
Moves the particle.