next up previous
Next: Using extended precision Up: Example 1 Previous: Example 1

On the ``automatically generated'' main program

Since we did not specify the initial conditions in our last example, the main program asks us to input them at run time. Initial values, error tolerance and stop conditions can be specified in the input file. We stress that this information is only used to produce the main() driving function.

The syntax for specifying initial values is:

  initial_values = expr, expr, ..., expr;
For example:
  initial_values = cos(0.1)*2, 0.4, exp(0.5);

For time step, error tolerance and stop conditions, taylor uses a few reserverd variables (names). They are:

start_time = expr;               /* start time */
stop_time = expr;                /* stop time: stop condition  */
absolute_error_tolerance = expr; /* absolute error tolerance */
relative_error_tolerance = expr; /* relative error tolerance */
number_of_steps=expr;            /* stop condition */
Here the right hand expressions must reduce to real constants. stop_time and number_of_steps provide two mechanisms to stop the integrator. The solver will stop when either condition is met. Please be advised that expressions here are evaluated in double precision first, and pass the result to the macro MakeMyFloatC(var,string_form,double_value).

For example, we can add the following lines to lorenz.eq1.

    initial_values= 0.1,  0.2, 0.3;
    start_time= 0.0;
    stop_time = 0.3;
    absolute_error_tolerance = 0.1e-16;
    relative_error_tolerance = 0.1e-16;



Maorong Zou
Tue Nov 13 09:42:48 CST 2001