Variables

For our example, we have two spatial phase space variables, namely $\phi$ and $v$. Because the equations of motion (Equation 4.1) are invariant under the coordinate transformation $\phi \to \phi + 2n \pi$, $n \in \mbox{\Bbb Z}$, it is natural to display $\phi$ on the interval $[0, 2 \pi]$. 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 $(\phi_0, v_0)$, which we arbitrarily select to be the origin, $(0,0)$.

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

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 that TWOPI ($2 \pi$) and PI ($\pi$) 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.

Adrian Bunk 2001-08-22