next up previous contents
Next: Parameters Up: Defining Labels and Initial Previous: Defining Labels and Initial   Contents


Variables

For our example, we have two spatial phase space variables, namely 19#19 and v. Because the equations of motion (Equation 3.1) are invariant under the coordinate transformation 34#34, 35#35, it is natural to display 19#19 on the interval 36#36. There is no ``natural'' interval to use in displaying the v coordinate, since v can be any real number, but we will choose the interval [-30, 30] as a default range on which to display v. We will also need to choose a default initial condition 37#37, which we arbitrarily select to be the origin, (0,0).

After implementing these choices, the relevant code in bball_init() looks like:

static int     n_varb=2;                      /* dim of phase space           */
static char    *variable_names[]={"phi","v"}; /* list of phase varb names     */
static double  variables[]={0.,0.};           /* default varb initial values  */
static double  variable_min[]={0.,-30.};      /* default varb min for display */
static double  variable_max[]={TWOPI,30};     /* default varb max for display */
We remark the TWOPI (38#38) and PI (39#39) are two constants which the user may use in defining a dynamical system.

Although we have defined labels and initial values for the spatial variables, the independent variable (usually thought of as time) is also considered to be a member of every phase space. The code which provides this information is given by:

static char    *indep_varb_name="time";  /* name of indep variable             */
static double  indep_varb_min=0.;        /* default indep varb min for display */
static double  indep_varb_max=10000.;    /* default indep varb max for display */
In fact, this is the way the code looked when we copied it from GENERIC.c, so we do not need to make any changes to the code. If we wanted to call the independent variable ``iteration'' instead of ``time,'' or if we wanted to change the default plotting range, then the code segment above would have to be appropriately modified.


next up previous contents
Next: Parameters Up: Defining Labels and Initial Previous: Defining Labels and Initial   Contents
root
1998-11-02