org.opensourcephysics.sip.ch02
Class SHO

java.lang.Object
  extended by org.opensourcephysics.sip.ch02.SHO

public class SHO
extends java.lang.Object

SHO models a simple harmonic oscillator.


Constructor Summary
SHO()
          Creates a simple harmonic oscillator at x = 0 with v = 0.
 
Method Summary
 double analyticPosition(double y0, double v0)
          Computes the position using the given initial position and initial velocity.
 double analyticVelocity(double y0, double v0)
          Computes the velocity using the given initial position and initial velocity.
 void step()
          Steps (advances) the dynamical variables using the Euler algorithm.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SHO

public SHO()
Creates a simple harmonic oscillator at x = 0 with v = 0.

Method Detail

step

public void step()
Steps (advances) the dynamical variables using the Euler algorithm.


analyticPosition

public double analyticPosition(double y0,
                               double v0)
Computes the position using the given initial position and initial velocity.

Returns:
double

analyticVelocity

public double analyticVelocity(double y0,
                               double v0)
Computes the velocity using the given initial position and initial velocity.

Returns:
double