Intro ODE

Scriptable ODE

 

ODE allows the scripting of ordinary differential equations.   Since the ODE Physlet does not incorporate any data display capabilities, inter-applet communication must be used to pass the solution to a display Physlet, such as DataGraph.

Scripting

The addObject method is used to specify a differential equation.

addObject( String object_name, String parameters);

The first argument is the name of the object to be added and the second is a comma-delimited list of parameters.  Currently, ODE allows for only one type of object, an "ode."  The parameter list specifies the name of the variable, its initial value, and its rate equation.   The rate can be an analytic function of any of the rate variables.  For example, the rate equations for radioactive decay can be scripted as follows:

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

Notice that the  first equation specifies how time evolves and that the rate of change of time is one.  Any parameter could, of course, be used to as the independent parameter. 

For another example, the rate equations for the simple harmonic oscillator can be scripted as:

addObject("ode","var=t,value=0,rate=1");
addObject("ode","var=x,value=1,rate=v");
addObject("ode","var=v,value=0,rate=-2*x");

Data Source

Inter-applet communication is used to pass the solution of a system of first-order differential equations to a display applet.  The ODE data source id can be obtained using the getSourceID() method.  This data source provides the current variable values, var parameters, as well as their rates.  The rate variables are obtained by appending the word "_rate" to the variable name.  For example, the ODEs used to model radioactive decay  would provide the following four data source values: t, t_rate, n,  n_rate.


ODE is free for non-commercial educational use as outlined in the conditions of use.

ODE was written by  Wolfgang Christian.