1ODE(1) GNU Plotting Utilities ODE(1)
2
3
4
6 ode - numerical solution of ordinary differential equations
7
9 ode [ options ] [ file ]
10
12 ode is a tool that solves, by numerical integration, the initial value
13 problem for a specified system of first-order ordinary differential
14 equations. Three distinct numerical integration schemes are available:
15 Runge-Kutta-Fehlberg (the default), Adams-Moulton, and Euler. The
16 Adams-Moulton and Runge-Kutta schemes are available with adaptive step
17 size.
18
19 The operation of ode is specified by a program, written in its input
20 language. The program is simply a list of expressions for the deriva‐
21 tives of the variables to be integrated, together with some control
22 statements. Some examples are given in the EXAMPLES section.
23
24 ode reads the program from the specified file, or from standard input
25 if no file name is given. If reading from standard input, ode will
26 stop reading and exit when it sees a single period on a line by itself.
27
28 At each time step, the values of variables specified in the program are
29 written to standard output. So a table of values will be produced,
30 with each column showing the evolution of a variable. If there are
31 only two columns, the output can be piped to graph(1) or a similar
32 plotting program.
33
35 Input Options
36 -f file
37 --input-file file
38 Read input from file before reading from standard input. This
39 option makes it possible to work interactively, after reading a
40 program fragment that defines the system of differential equa‐
41 tions.
42
43 Output Options
44 -p prec
45 --precision prec
46 When printing numerical results, use prec significant digits
47 (the default is 6). If this option is given, the print format
48 will be scientific notation.
49
50 -t
51 --title
52 Print a title line at the head of the output, naming the vari‐
53 ables in each column. If this option is given, the print format
54 will be scientific notation.
55
56 Integration Scheme Options
57 The following options specify the numerical integration scheme. Only
58 one of the three basic options -R, -A, -E may be specified. The
59 default is -R (Runge-Kutta-Fehlberg).
60
61 -R [stepsize]
62 --runge-kutta [stepsize]
63 Use a fifth-order Runge-Kutta-Fehlberg algorithm, with an adap‐
64 tive stepsize unless a constant stepsize is specified. When a
65 constant stepsize is specified and no error analysis is
66 requested, then a classical fourth-order Runge-Kutta scheme is
67 used.
68
69 -A [stepsize]
70 --adams-moulton [stepsize]
71 Use a fourth-order Adams-Moulton predictor-corrector scheme,
72 with an adaptive stepsize unless a constant stepsize, stepsize,
73 is specified. The Runge-Kutta-Fehlberg algorithm is used to get
74 past `bad' points (if any).
75
76 -E [stepsize]
77 --euler [stepsize]
78 Use a `quick and dirty' Euler scheme, with a constant stepsize.
79 The default value of stepsize is 0.1. Not recommended for seri‐
80 ous applications.
81
82 The error bound options -r and -e (see below) may not be used if
83 -E is specified.
84
85 -h hmin [hmax]
86 --step-size-bound hmin [hmax]
87 Use a lower bound hmin on the stepsize. The numerical scheme
88 will not let the stepsize go below hmin. The default is to
89 allow the stepsize to shrink to the machine limit, i.e., the
90 minimum nonzero double-precision floating point number.
91
92 The optional argument hmax, if included, specifies a maximum
93 value for the stepsize. It is useful in preventing the numeri‐
94 cal routine from skipping quickly over an interesting region.
95
96 Error Bound Options
97 -r rmax [rmin]
98 --relative-error-bound rmax [rmin]
99 The -r option sets an upper bound on the relative single-step
100 error. If the -r option is used, the relative single-step error
101 in any dependent variable will never exceed rmax (the default
102 for which is 10^-9). If this should occur, the solution will be
103 abandoned and an error message will be printed. If the stepsize
104 is not constant, the stepsize will be decreased `adaptively', so
105 that the upper bound on the single-step error is not violated.
106 Thus, choosing a smaller upper bound on the single-step error
107 will cause smaller stepsizes to be chosen. A lower bound rmin
108 may optionally be specified, to suggest when the stepsize should
109 be increased (the default for rmin is rmax/1000).
110
111 -e emax [emin]
112 --absolute-error-bound emax [emin]
113 Similar to -r, but bounds the absolute rather than the relative
114 single-step error.
115
116 -s
117 --suppress-error-bound
118 Suppress the ceiling on single-step error, allowing ode to con‐
119 tinue even if this ceiling is exceeded. This may result in
120 large numerical errors.
121
122 Informational Options
123 --help Print a list of command-line options, and exit.
124
125 --version
126 Print the version number of ode and the plotting utilities pack‐
127 age, and exit.
128
130 Mostly self-explanatory. The biggest exception is `syntax error',
131 meaning there is a grammatical error. Language error messages are of
132 the form
133
134 ode: nnn: message...
135
136 where `nnn' is the number of the input line containing the error. If
137 the -f option is used, the phrase "(file)" follows the `nnn' for errors
138 encountered inside the file. Subsequently, when ode begins reading the
139 standard input, line numbers start over from 1.
140
141 No effort is made to recover successfully from syntactic errors in the
142 input. However, there is a meager effort to resynchronize so more than
143 one error can be found in one scan.
144
145 Run-time errors elicit a message describing the problem, and the solu‐
146 tion is abandoned.
147
149 The program
150
151 y' = y
152 y = 1
153 print t, y
154 step 0, 1
155
156 solves an initial value problem whose solution is y=e^t. When ode runs
157 this program, it will write two columns of numbers to standard output.
158 Each line will show the value of the independent variable t, and the
159 variable y, as t is stepped from 0 to 1.
160
161 A more sophisticated example would be
162
163 sine' = cosine
164 cosine' = -sine
165 sine = 0
166 cosine = 1
167 print t, sine
168 step 0, 2*PI
169
170 This program solves an initial value problem for a system of two dif‐
171 ferential equations. The initial value problem turns out to define the
172 sine and cosine functions. The program steps the system over a full
173 period.
174
176 ode was written by Nicholas B. Tufillaro (nbt@reed.edu), and slightly
177 enhanced by Robert S. Maier (rsm@math.arizona.edu) to merge it into the
178 GNU plotting utilities.
179
181 "The GNU Plotting Utilities Manual".
182
184 Email bug reports to bug-gnu-utils@gnu.org.
185
186
187
188FSF Dec 1998 ODE(1)