Next: Numerical Error, Previous: ode Invocation, Up: ode

`ode`

is always in one of two states:

- Reading input. The input includes a specification of a system of
ordinary differential equations, together with instructions for
solving it numerically: a ‘
`print`’ line and a ‘`step`’ line. - Numerically solving a system, and printing the resulting output.

`ode`

moves from the first to the second state after it sees and
processes a ‘`step`’ line. It returns to the first state after
the generated output has been printed. Errors may occur in the
`reading' state or the `solving' state, and may terminate computations
or even cause `ode`

to exit. We now explain the possible sorts of
error.

While reading input, `ode`

may encounter a syntax error: an
ungrammatical line that it is unable to parse. (For a summary of its
input grammar, see Input Language.) If so, it emits the error
message

ode::nnn: syntax error

where ‘`nnn`’ is the number of the line containing the error. When
the ‘`-f filename`’ option is used to specify an input file,
the error message will read

ode:filename:nnn: syntax error

for errors encountered inside the input file. Subsequently, when
`ode`

begins reading the standard input, line numbers will start
over again from 1.

No effort is made to recover from syntax errors in the input. However, there is a meager effort to resynchronize, so that more than one syntax error in a file may be found at the same time.

It is also possible that a fatal arithmetic exception (such as a
division by zero, or a floating point overflow) may occur while
`ode`

is reading input. If such an exception occurs, `ode`

will print an “Floating point exception” error message and exit.
Arithmetic exceptions are machine-dependent. On some machines, the
line

y = 1/0

would induce an arithmetic exception. Also on some machines (not necessarily the same ones), the lines

y = 1e100 z = y^4

would induce an arithmetic exception. That is because on most
machines, the double precision quantities that `ode`

uses
internally are limited to a maximum size of approximately 1.8x10^308.

When `ode`

is in the `solving' state, i.e., computing a numerical
solution, similar arithmetic exceptions may occur. If so, the solution
will be interrupted and a message resembling

ode: arithmetic exception while calculating y'

will be printed. However, `ode`

will not exit; the exception will
be `caught'. `ode`

itself recognizes the following exceptional
conditions: square root of a negative number, logarithm of a
non-positive number, and negative number raised to a non-integer power.
`ode`

will catch any of these operations before it is performed,
and print an error message specifying which illegal operation it has
encountered.

ode: square root of a negative number while calculating y'

would be a typical error message.

If the machine on which `ode`

is running supports the
‘`matherr`’ facility for reporting errors in the computation of
standard mathematical functions, it will be used. This facility reports
domain errors and range errors (overflows, underflows, and losses of
significance) that could occur when evaluating such functions as
‘`log`’, ‘`gamma`’, etc.; again, before they are performed. If
the `matherr`

facility is present, the error message will be fairly
informative. For example, the error message

ode: range error (overflow) in lgamma while calculating y'

could be generated if the logarithmic gamma function ‘`lgamma`’ is
evaluated at a value of its argument that is too large. The generation
of any such message, except a message warning of an underflow, will
cause the numerical solution to be interrupted.

There is another sort of error that may occur during numerical solution:
the condition that an error ceiling, which the user may set with the
‘`-r`’ option or the ‘`-e`’ option, is exceeded. This too will
cause the numerical solution to be abandoned, and `ode`

to switch
back to reading input.