ode.1 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. .TH ODE 1 "Dec 1998" "FSF" "GNU Plotting Utilities"
  2. .SH NAME
  3. ode \- numerical solution of ordinary differential equations
  4. .\" Not all man macros define SB
  5. .de SB
  6. \&\fB\s-1\&\\$1 \\$2\s0\fR
  7. ..
  8. .SH SYNOPSIS
  9. .B ode
  10. [
  11. .I options
  12. ] [
  13. .I file
  14. ]
  15. .SH DESCRIPTION
  16. .LP
  17. .B ode
  18. is a tool that solves, by numerical integration, the initial value problem
  19. for a specified system of first-order ordinary differential equations.
  20. Three distinct numerical integration schemes are available:
  21. Runge\-Kutta\-Fehlberg (the default), Adams\-Moulton, and Euler. The
  22. Adams\-Moulton and Runge\-Kutta schemes are available with adaptive step
  23. size.
  24. .LP
  25. The operation of
  26. .B ode
  27. is specified by a program, written in its input language.
  28. The program is simply a list of expressions for the derivatives of the
  29. variables to be integrated, together with some control statements.
  30. Some examples are given in the
  31. .SB EXAMPLES
  32. section.
  33. .LP
  34. .B ode
  35. reads the program from the specified file, or from standard input if
  36. no file name is given.
  37. If reading from standard input, \fBode\fP
  38. will stop reading and exit when it sees a single period on a line by
  39. itself.
  40. .LP
  41. At each time step, the values of variables specified in the program are
  42. written to standard output.
  43. So a table of values will be produced, with each column showing the
  44. evolution of a variable. If there are only two columns, the output
  45. can be piped to
  46. .BR graph (1)
  47. or a similar plotting program.
  48. .SH OPTIONS
  49. .SS Input Options
  50. .TP
  51. .BI \-f " file"
  52. .br
  53. .ns
  54. .TP
  55. .BI \-\-input\-file " file"
  56. Read input from \fIfile\fP\^ before reading from standard input.
  57. This option makes it possible to work interactively, after reading a
  58. program fragment that defines the system of differential equations.
  59. .SS Output Options
  60. .TP
  61. .BI \-p " prec"
  62. .br
  63. .ns
  64. .TP
  65. .BI \-\-precision " prec"
  66. When printing numerical results,
  67. use \fIprec\fP\^ significant digits (the default is 6).
  68. If this option is given, the print format will be scientific notation.
  69. .TP
  70. .B \-t
  71. .br
  72. .ns
  73. .TP
  74. .B \-\-title
  75. Print a title line at the head of the output, naming the variables
  76. in each column.
  77. If this option is given, the print format will be scientific notation.
  78. .SS Integration Scheme Options
  79. The following options specify the numerical integration scheme.
  80. Only one of the three basic options \fB\-R\fP, \fB\-A\fP, \fB\-E\fP
  81. may be specified.
  82. The default is \fB\-R\fP (Runge\-Kutta\-Fehlberg).
  83. .TP
  84. .BI \-R " [stepsize]"
  85. .br
  86. .ns
  87. .TP
  88. .BI \-\-runge\-kutta " [stepsize]"
  89. Use a fifth-order Runge\-Kutta\-Fehlberg algorithm, with an adaptive
  90. stepsize unless a constant stepsize is specified.
  91. When a constant stepsize is specified and no error analysis is requested,
  92. then a classical fourth-order Runge\-Kutta scheme is used.
  93. .TP
  94. .BI \-A " [stepsize]"
  95. .br
  96. .ns
  97. .TP
  98. .BI \-\-adams\-moulton " [stepsize]"
  99. Use a fourth-order Adams\-Moulton predictor-corrector scheme, with an
  100. adaptive stepsize unless a constant stepsize, \fIstepsize\fP\^, is
  101. specified.
  102. The Runge\-Kutta\-Fehlberg algorithm is used to get past `bad'
  103. points (if any).
  104. .TP
  105. .BI \-E " [stepsize]"
  106. .br
  107. .ns
  108. .TP
  109. .BI \-\-euler " [stepsize]"
  110. Use a `quick and dirty' Euler scheme, with a constant stepsize.
  111. The default value of \fIstepsize\fP\^ is 0.1.
  112. Not recommended for serious applications.
  113. .IP ""
  114. The error bound options \fB\-r\fP and \fB\-e\fP (see below) may not be used
  115. if \fB\-E\fP is specified.
  116. .TP
  117. .BI \-h " hmin [hmax]"
  118. .br
  119. .ns
  120. .TP
  121. .BI \-\-step\-size\-bound " hmin [hmax]"
  122. Use a lower bound \fIhmin\fP\^ on the stepsize.
  123. The numerical scheme will not let the stepsize go below \fIhmin\fP\^.
  124. The default is to allow the stepsize to shrink to the machine limit, i.e.,
  125. the minimum nonzero double-precision floating point number.
  126. .IP ""
  127. The optional argument \fIhmax\fP\^, if included, specifies a maximum value
  128. for the stepsize.
  129. It is useful in preventing the numerical routine from skipping quickly over
  130. an interesting region.
  131. .SS Error Bound Options
  132. .TP
  133. .BI \-r " rmax [rmin]"
  134. .br
  135. .ns
  136. .TP
  137. .BI \-\-relative\-error\-bound " rmax [rmin]"
  138. The \fB\-r\fP option sets an upper bound on the relative single-step error.
  139. If the \fB\-r\fP option is used, the relative single-step error in any
  140. dependent variable will never exceed \fIrmax\fP\^ (the default for which is
  141. 10^-9).
  142. If this should occur, the solution will be abandoned and an error message
  143. will be printed.
  144. If the stepsize is not constant, the stepsize will be decreased
  145. `adaptively', so that the upper bound on the single-step error is not
  146. violated.
  147. Thus, choosing a smaller upper bound on the single-step error will cause
  148. smaller stepsizes to be chosen.
  149. A lower bound \fIrmin\fP\^ may optionally be specified, to suggest when the
  150. stepsize should be increased (the default for \fIrmin\fP\^ is
  151. \fIrmax\fP\^/1000).
  152. .TP
  153. .BI \-e " emax [emin]"
  154. .br
  155. .ns
  156. .TP
  157. .BI \-\-absolute\-error\-bound " emax [emin]"
  158. Similar to \fB\-r\fP, but bounds the absolute rather than the relative
  159. single-step error.
  160. .TP
  161. .B \-s
  162. .br
  163. .ns
  164. .TP
  165. .B \-\-suppress\-error\-bound
  166. Suppress the ceiling on single-step error, allowing \fBode\fP to continue
  167. even if this ceiling is exceeded.
  168. This may result in large numerical errors.
  169. .SS Informational Options
  170. .TP
  171. .B \-\-help
  172. Print a list of command-line options, and exit.
  173. .TP
  174. .B \-\-version
  175. Print the version number of \fBode\fP and the plotting utilities package,
  176. and exit.
  177. .SH DIAGNOSTICS
  178. .LP
  179. Mostly self-explanatory.
  180. The biggest exception is `syntax error', meaning there is a grammatical error.
  181. Language error messages are of the form
  182. .LP
  183. .RS
  184. .B ode: nnn: message\|.\|.\|.
  185. .RE
  186. .LP
  187. where `nnn' is the number of the input line containing the error.
  188. If the
  189. .B \-f
  190. option is used, the phrase "(file)" follows the `nnn' for errors encountered
  191. inside the file.
  192. Subsequently, when \fBode\fP begins reading the standard input,
  193. line numbers start over from 1.
  194. .LP
  195. No effort is made to recover successfully from syntactic errors in the input.
  196. However, there is a meager effort to resynchronize so more than one error
  197. can be found in one scan.
  198. .LP
  199. Run-time errors elicit a message describing the problem, and the solution is
  200. abandoned.
  201. .SH EXAMPLES
  202. The program
  203. .LP
  204. .RS
  205. .B y' = y
  206. .br
  207. .B y = 1
  208. .br
  209. .B print t, y
  210. .br
  211. .B step 0, 1
  212. .RE
  213. .LP
  214. solves an initial value problem whose solution is \fIy=e^t\fP\^.
  215. When \fBode\fP runs this program, it will
  216. write two columns of numbers to standard output.
  217. Each line will show the value of the independent variable \fIt\fP\^, and
  218. the variable \fIy\fP\^, as \fIt\fP\^ is stepped from 0 to 1.
  219. .LP
  220. A more sophisticated example would be
  221. .LP
  222. .RS
  223. .B sine' = cosine
  224. .br
  225. .B cosine' = \-sine
  226. .br
  227. .B sine = 0
  228. .br
  229. .B cosine = 1
  230. .br
  231. .B print t, sine
  232. .br
  233. .B step 0, 2*PI
  234. .RE
  235. .LP
  236. This program solves an initial value problem for a system of two
  237. differential equations.
  238. The initial value problem turns out to define the sine and cosine
  239. functions.
  240. The program steps the system over a full period.
  241. .SH AUTHORS
  242. \fBode\fP was written by Nicholas B. Tufillaro
  243. .RB ( nbt@reed.edu ),
  244. and slightly enhanced by Robert S. Maier
  245. .RB ( rsm@math.arizona.edu )
  246. to merge it into the GNU plotting utilities.
  247. .SH "SEE ALSO"
  248. "The GNU Plotting Utilities Manual".
  249. .SH BUGS
  250. Email bug reports to
  251. .BR bug\-gnu\-utils@gnu.org .