Intro Template

Pendulum Example

Calculating data sets

ODE can be used to calculate a multi-point data set in a single operation.  However, the data source id must first be obtained and the number of points in the data set must be specified.   This is done using the getDataID method.

sid = getDataID(int numpts);

The source identifier, sid, can then be used to make a data connection to the data set.

Note the following.  The applet's animation clock is used to control the rate at which data sets are calculated.  You would normally calculate a single data set containing numpts by invoking a single clock tick using the stepClock() method.   You can, of course, calculate a multiple data sets by using the startClock() method.  Since the calculation of a data set causes the system to step forward by numpts during a clock tick, the number of ODE steps will not equal the number of clock ticks.  In other words, if the differential equation for time, t, is written as

addObject("ode","var=t,value=0,rate=1");

then the time parameter will increase by numpts*t during every animation tick.