ode
Class ODE

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--java.applet.Applet
                          |
                          +--edu.davidson.tools.SApplet
                                |
                                +--ode.ODE
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class ODE
extends SApplet

The class ODE solves systems of first order ordinary differential equation, ODEs, and passes the solution to data listeners.

See Also:
Serialized Form

Fields inherited from class edu.davidson.tools.SApplet
clock, dataConnections, dataListeners, dataSources, lock
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ODE()
          ODE constructor.
 
Method Summary
 void addObject(java.lang.String name, java.lang.String list)
          Create an object and add it to the Physlet.
 void forward()
          Start the animation.
 java.lang.String getAppletInfo()
           
 int getDataID(int numpts)
          Create a multi-point data set and return the id for use in a data connection.
 java.lang.String getParameter(java.lang.String key, java.lang.String def)
           
 java.lang.String[][] getParameterInfo()
           
 int getSourceID()
          Get the data source identifier for the ODE solver.
 void init()
          Initialize the applet.
static void main(java.lang.String[] args)
          Entry point for standalone application.
 boolean parse()
          Parser the ODE objects to produce the system of rate equations.
 void pause()
          Pause the animation.
 void reset()
          Reset the initial conditions at time t=0.
 void reverse()
          Reverse the direction of the time step in the animation.
 boolean set(int id, java.lang.String name, java.lang.String parList)
          Change the properies of an object.
 void setDefault()
          Remove the current system of ODEs and delete the data connections.
 void setODEStep(double h)
          Set the ODE step.
 void setTolerance(double t)
          Set the tolerance.
 void showEquations()
          Show the differential equations in a text window.
 void start()
          Called by browser to start the applet.
 void stepBack()
          Step back by one ODE step.
 void stepForward()
          Step forward by one ODE step.
 
Methods inherited from class edu.davidson.tools.SApplet
addDataListener, addDataSource, cleanupDataConnections, clearAllData, clearData, deleteDataConnection, deleteDataConnections, destroy, getClockID, getClockTime, getDataConnectionFromDL, getDataConnectionFromDS, getDataFromDS, getDataListener, getDataListener, getDataSource, getDataSource, getID, getRunningID, getSourceData, getSourceVariables, isAutoRefresh, isClockRunning, makeDataConnection, removeDataListener, removeDataSource, setAutoRefresh, setClockContinous, setClockCycle, setClockOneShot, setClockTime, setConnectionBlock, setConnectionListener, setConnectionSmoothing, setConnectionSource, setConnectionStride, setDt, setExternalClock, setFPS, setRunningID, setRunningID, setTimeContinuous, setTimeCycle, setTimeOneShot, startClock, stepClock, stepTime, stepTimeBack, stepTimeForward, stopClock, updateDataConnection, updateDataConnections
 
Methods inherited from class java.applet.Applet
getAccessibleContext, getAppletContext, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, stop
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, remove, remove, removeAll, removeContainerListener, removeNotify, setFont, setLayout, update, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, disable, dispatchEvent, enable, enable, enableInputMethods, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ODE

public ODE()
ODE constructor.
Method Detail

addObject

public void addObject(java.lang.String name,
                      java.lang.String list)
Create an object and add it to the Physlet. Many Physlets use the addObject method. The first argument is the name of the object to be added and the second is a comma-delimited list of parameters. In this applet a system of ODEs can be created a follows:

addObject ("ode","var=t,value=0,eqn=1"); addObject ("ode","var=n,value=100,eqn=-0.1*t");

The above example produces exponential decay of the variable n.
Parameters:
name - the type of object to be created
parList - a list of parameters to be set

forward

public void forward()
Start the animation.
Overrides:
forward in class SApplet

getAppletInfo

public final java.lang.String getAppletInfo()
Overrides:
getAppletInfo in class java.applet.Applet

getDataID

public int getDataID(int numpts)
Create a multi-point data set and return the id for use in a data connection. The data source will contain the multiple values of the state variables.
Parameters:
numpts - the number of points in the data set
Returns:
int the data source identifier

getParameter

public java.lang.String getParameter(java.lang.String key,
                                     java.lang.String def)

getParameterInfo

public java.lang.String[][] getParameterInfo()
Overrides:
getParameterInfo in class java.applet.Applet

getSourceID

public int getSourceID()
Get the data source identifier for the ODE solver. The data source will contain the current values of the state variables.
Returns:
int the data source identifier

init

public void init()
Initialize the applet.
Overrides:
init in class java.applet.Applet

main

public static void main(java.lang.String[] args)
Entry point for standalone application.

parse

public boolean parse()
Parser the ODE objects to produce the system of rate equations. Call this method after all ODEs have been created using the addObject method.
Returns:
true if equations are valid

pause

public void pause()
Pause the animation.
Overrides:
pause in class SApplet

reset

public void reset()
Reset the initial conditions at time t=0.
Overrides:
reset in class SApplet

reverse

public void reverse()
Reverse the direction of the time step in the animation.
Overrides:
reverse in class SApplet

set

public boolean set(int id,
                   java.lang.String name,
                   java.lang.String parList)
Change the properies of an object. The first argument is the object identifier. The second argument is the name of the property and the third is a comma-delimited list of parameters. For example, the current value of a variable associated with a particular ode can be changed using the following code.

set(id, "ode", "value=2");

The initial value can be changed as follows.

set(id, "ode", "initial=-1");

Parameters:
id - the identifier of the object
name - the type of property to be created.
parList - a list of parameters
Returns:
true if successful

setDefault

public void setDefault()
Remove the current system of ODEs and delete the data connections. The ode step will be set equal to the clock time step.
Overrides:
setDefault in class SApplet

setODEStep

public void setODEStep(double h)
Set the ODE step.

setTolerance

public void setTolerance(double t)
Set the tolerance. Default is 1 part in 1.0e-8.

showEquations

public void showEquations()
Show the differential equations in a text window.

start

public void start()
Called by browser to start the applet. DO NOT SCRIPT.
Overrides:
start in class java.applet.Applet

stepBack

public void stepBack()
Step back by one ODE step.

stepForward

public void stepForward()
Step forward by one ODE step.

Copyright Wolfgang Christian

Visit the Davidson CollegePhyslets Page