odesolve.tex 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983
  1. \documentclass[a4paper]{article} % LaTeX2e
  2. \usepackage{hyperref}
  3. \newcommand{\ODESolve}[1]{\texttt{ODESolve\,#1}}
  4. \newcommand{\odesolve}{\texttt{odesolve}}
  5. \newcommand{\REDUCE}{\textsc{Reduce}}
  6. \title{\ODESolve{1.065} : \\ An Enhanced \REDUCE{} ODE Solver}
  7. \author{Francis J. Wright \\
  8. School of Mathematical Sciences \\
  9. Queen Mary, University of London \\
  10. Mile End Road, London E1 4NS, UK. \\
  11. \texttt{F.J.Wright@qmw.ac.uk} \\
  12. \href{http://centaur.maths.qmw.ac.uk/}
  13. {\texttt{http://centaur.maths.qmw.ac.uk/}}}
  14. \date{14 August 2001}
  15. \begin{document}
  16. \maketitle
  17. \tableofcontents
  18. \section{Introduction}
  19. \ODESolve{1+} is an experimental project to update and enhance the
  20. ordinary differential equation (ODE) solver (\odesolve{}) that has
  21. been distributed as a standard component of \REDUCE{}
  22. \cite{Hearn-manual,MacCallum-doc,MacCallum-ISSAC} for about 10 years.
  23. \ODESolve{1+} is intended to provide a strict superset of the
  24. facilities provided by \odesolve{}. This document describes a
  25. substantial re-implementation of previous versions of \ODESolve{1+}
  26. that now includes almost none of the original \odesolve{} code. This
  27. version is targeted at \REDUCE~3.7 or later, and will not run in
  28. earlier versions. This project is being conducted partly under the
  29. auspices of the European CATHODE project \cite{CATHODE}. Various test
  30. files, including three versions based on a published review of ODE
  31. solvers \cite{Zimmermann}, are included in the \ODESolve{1+}
  32. distribution. For further background see \cite{FJW1}, which describes
  33. version 1.03. See also \cite{FJW2}.
  34. \ODESolve{1+} is intended to implement some solution techniques itself
  35. (i.e.\ most of the simple and well known techniques \cite{Zwillinger})
  36. and to provide an automatic interface to other more sophisticated
  37. solvers, such as PSODE \cite{Man,Man-MacCallum,Prelle-Singer} and
  38. CRACK \cite{CRACK-doc}, to handle cases where simple techniques fail.
  39. It is also intended to provide a unified interface to other special
  40. solvers, such as Laplace transforms, series solutions and numerical
  41. methods, under user request. Although none of these extensions is
  42. explicitly implemented yet, a general extension interface is
  43. implemented (see \S\ref{OEI}).
  44. The main motivation behind \ODESolve{1+} is pragmatic. It is intended
  45. to meet user expectations, to have an easy user interface that
  46. normally does the right thing automatically, and to return solutions
  47. in the form that the user wants and expects. Quite a lot of
  48. development effort has been directed toward this aim. Hence,
  49. \ODESolve{1+} solves common text-book special cases in preference to
  50. esoteric pathological special cases, and it endeavours to simplify
  51. solutions into convenient forms.
  52. \section{Installation}
  53. The file \texttt{odesolve.in} inputs the full set of source files that
  54. are required to implement \ODESolve{1+} \emph{assuming that the
  55. current directory is the \ODESolve{1+} source directory}. Hence,
  56. \ODESolve{1+} can be run without compiling it in any implementation of
  57. \REDUCE~3.7 by starting \REDUCE{} in the \ODESolve{1+} source
  58. directory and entering the statement
  59. \begin{verbatim}
  60. 1: in "odesolve.in"$
  61. \end{verbatim}
  62. However, the recommended procedure is to compile it by starting
  63. \REDUCE{} in the \ODESolve{1+} source directory and entering the
  64. statements
  65. \begin{verbatim}
  66. 1: faslout odesolve;
  67. 2: in "odesolve.in"$
  68. 3: faslend;
  69. \end{verbatim}
  70. In CSL-\REDUCE{}, this will work only if you have write access to the
  71. \REDUCE{} image file (\texttt{reduce.img}), so you may need to set up
  72. a private copy first. In PSL-\REDUCE{}, you may need to move the
  73. compiled image file \texttt{odesolve.b} to a directory in your PSL
  74. load path, such as the main fasl directory. Please refer to the
  75. documentation for your implementation of \REDUCE{} for details. Once
  76. a compiled version of \ODESolve{1+} has been correctly installed, it
  77. can be loaded by entering the \REDUCE{} statement
  78. \begin{verbatim}
  79. 1: load_package odesolve;
  80. \end{verbatim}
  81. A string describing the current version of \ODESolve{1+} is assigned
  82. to the algebraic-mode variable \verb|odesolve_version|, which can be
  83. evaluated to check what version is actually in use.
  84. In versions of \REDUCE{} derived from the development source after 22
  85. September 2000, use of the normal algebraic-mode \odesolve{} operator
  86. causes the package to autoload. However, the \ODESolve{1+} global
  87. switches are not declared, and the symbolic mode interface provided
  88. for backward compatibility with the previous version is not defined,
  89. until after the package has loaded. The former is not a huge problem
  90. because all \ODESolve{} switches can be accessed as optional
  91. arguments, and the backward compatibility interface should probably
  92. not be used in new code anyway.
  93. \section{User interface}
  94. The principal interface is via the operator \odesolve{}. (It also has
  95. a synonym called \texttt{dsolve} to make porting of examples from
  96. Maple easier, but it does not accept general Maple syntax!) For
  97. purposes of description I will refer to the dependent variable as
  98. ``$y$'' and the independent variable as ``$x$'', but of course the
  99. names are arbitrary. The general input syntax is
  100. \begin{verbatim}
  101. odesolve(ode, y, x, conditions, options);
  102. \end{verbatim}
  103. All arguments except the first are optional. This is possible
  104. because, if necessary, \ODESolve{1+} attempts to deduce the dependent
  105. and independent variables used and to make any necessary
  106. \texttt{DEPEND} declarations. Messages are output to indicate any
  107. assumptions or dependence declarations that are made. Here is an
  108. example of what is probably the shortest possible valid input:
  109. \begin{verbatim}
  110. odesolve(df(y,x));
  111. *** Dependent var(s) assumed to be y
  112. *** Independent var assumed to be x
  113. *** depend y , x
  114. {y=arbconst(1)}
  115. \end{verbatim}
  116. Output of \ODESolve{1+} messages is controlled by the standard
  117. \REDUCE{} switch \texttt{msg}.
  118. \subsection{Specifying the ODE and its variables}
  119. The first argument (\texttt{ode}) is \emph{required}, and must be
  120. either an ODE or a variable (or expression) that evaluates to an
  121. ODE\@. Automatic dependence declaration works \emph{only} when the
  122. ODE is input \emph{directly} as an argument to the \odesolve{}
  123. operator. Here, ``ODE'' means an equation or expression containing
  124. one or more derivatives of $y$ with respect to $x$. Derivatives of
  125. $y$ with respect to other variables are not allowed because
  126. \ODESolve{1+} does not solve \emph{partial} differential equations,
  127. and symbolic derivatives of variables other than $y$ are treated as
  128. symbolic constants. An expression is implicitly equated to zero, as
  129. is usual in equation solvers.
  130. The independent variable may be either an operator that explicitly
  131. depends on the independent variable, e.g.\ $y(x)$ (as required in
  132. Maple), or a simple variable that is declared (by the user or
  133. automatically by \ODESolve{1+}) to depend on the independent variable.
  134. If the independent variable is an operator then it may depend on
  135. parameters as well as the independent variable. Variables may be
  136. simple identifiers or, more generally, \REDUCE{} ``kernels'', e.g.
  137. \begin{verbatim}
  138. operator x, y;
  139. odesolve(df(y(x(a),b),x(a)) = 0);
  140. *** Dependent var(s) assumed to be y(x(a),b)
  141. *** Independent var assumed to be x(a)
  142. {y(x(a),b)=arbconst(1)}
  143. \end{verbatim}
  144. The order in which arguments are given must be preserved, but
  145. arguments may be omitted, except that if $x$ is specified then $y$
  146. must also be specified, although an empty list \verb|{}| can be used
  147. as a ``place-holder'' to represent ``no specified argument''.
  148. Variables are distinguished from options by requiring that if a
  149. variable is specified then it must appear in the ODE, otherwise it is
  150. assumed to be an option.
  151. Generally in \REDUCE{} it is not recommended to use the identifier
  152. \verb|t| as a variable, since it is reserved in Lisp. However, it is
  153. very common practice in applied mathematics to use it as a variable to
  154. represent time, and for that reason \ODESolve{1+} provides special
  155. support to allow it as either the independent or a dependent variable.
  156. But, of course, its use may still cause trouble in other parts of
  157. \REDUCE!
  158. \subsection{Specifying conditions}
  159. If specified, the ``conditions'' argument must take the form of an
  160. (unordered) list of (unordered lists of) equations with either $y$,
  161. $x$, or a derivative of $y$ on the left. A single list of conditions
  162. need not be contained within an outer list. Combinations of
  163. conditions are allowed. Conditions within one (inner) list all relate
  164. to the same $x$ value. For example:
  165. \begin{description}
  166. \item[Boundary conditions:] ~ \\
  167. \{\{y=y0, x=x0\}, \{y=y1, x=x1\}, ...\}
  168. \item[Initial conditions:] ~ \\
  169. \{x=x0, y=y0, df(y,x)=dy0, ...\}
  170. \item[Combined conditions:] ~ \\
  171. \{\{y=y0, x=x0\}, \{df(y,x)=dy1, x=x1\}, \{df(y,x)=dy2, y=y2, x=x2\}, ...\}
  172. \end{description}
  173. Here is an example of boundary conditions:
  174. \begin{verbatim}
  175. odesolve(df(y,x,2) = y, y, x, {{x = 0, y = A}, {x = 1, y = B}});
  176. 2*x 2*x 2
  177. - e *a + e *b*e + a*e - b*e
  178. {y=-----------------------------------}
  179. x 2 x
  180. e *e - e
  181. \end{verbatim}
  182. Here is an example of initial conditions:
  183. \begin{verbatim}
  184. odesolve(df(y,x,2) = y, y, x, {x = 0, y = A, df(y,x) = B});
  185. 2*x 2*x
  186. e *a + e *b + a - b
  187. {y=-------------------------}
  188. x
  189. 2*e
  190. \end{verbatim}
  191. Here is an example of combined conditions:
  192. \begin{verbatim}
  193. odesolve(df(y,x,2) = y, y, x, {{x=0, y=A}, {x=1, df(y,x)=B}});
  194. 2*x 2*x 2
  195. e *a + e *b*e + a*e - b*e
  196. {y=--------------------------------}
  197. x 2 x
  198. e *e + e
  199. \end{verbatim}
  200. Boundary conditions on the values of $y$ at various values of $x$ may
  201. also be specified by replacing the variables by equations with single
  202. values or matching lists of values on the right, of the form
  203. \begin{center}
  204. y = y0, x = x0
  205. \end{center}
  206. or
  207. \begin{center}
  208. y = \{y0, y1, ...\}, x = \{x0, x2, ...\}
  209. \end{center}
  210. For example
  211. \begin{verbatim}
  212. odesolve(df(y,x) = y, y = A, x = 0);
  213. x
  214. {y=e *a}
  215. odesolve(df(y,x,2) = y, y = {A, B}, x = {0, 1});
  216. 2*x 2*x 2
  217. - e *a + e *b*e + a*e - b*e
  218. {y=-----------------------------------}
  219. x 2 x
  220. e *e - e
  221. \end{verbatim}
  222. \subsection{Specifying options and defaults}
  223. The final arguments may be one or more of the option identifiers
  224. listed in the table below, which take precedence over the default
  225. settings. All options can also be specified on the right of equations
  226. with the identifier ``output'' on the left, e.g.\ ``output = basis''.
  227. This facility if provided mainly for compatibility with other systems
  228. such as Maple, although it also allows options to be distinguished
  229. from variables in case of ambiguity. Some options can be specified on
  230. the left of equations that assign special values to the option.
  231. Currently, only ``trode'' and its synonyms can be assigned the value 1
  232. to give an increased level of tracing.
  233. The following switches set default options -- they are all off by
  234. default. Options set locally using option arguments override the
  235. defaults set by switches.
  236. \begin{center}
  237. \begin{tabular}{lll}
  238. \bf Switch & \bf Option & \bf Effect on solution \\
  239. \hline
  240. odesolve\_explicit & explicit & fully explicit \\
  241. odesolve\_expand & expand & expand roots of unity \\
  242. odesolve\_full & full & fully explicit and expanded \\
  243. odesolve\_implicit & implicit & implicit instead of parametric \\
  244. & algint & turn on algint \\
  245. odesolve\_noint & noint & turn off selected integrations \\
  246. odesolve\_verbose & verbose & display ODE and conditions \\
  247. odesolve\_basis & basis & output basis solution for linear ODE \\
  248. & trode \\
  249. trode & trace & turn on algorithm tracing \\
  250. & tracing \\
  251. odesolve\_fast & fast & turn off heuristics \\
  252. odesolve\_check & check & turn on solution checking
  253. \end{tabular}
  254. \end{center}
  255. An ``explicit'' solution is an equation with $y$ isolated on the left
  256. whereas an ``implicit'' solution is an equation that determines $y$ as
  257. one or more of its solutions. A ``parametric'' solution expresses
  258. both $x$ and $y$ in terms of some additional parameter. Some solution
  259. techniques naturally produce an explicit solution, but some produce
  260. either an implicit or a parametric solution. The ``explicit'' option
  261. causes \ODESolve{1+} to attempt to convert solutions to explicit form,
  262. whereas the ``implicit'' option causes \ODESolve{1+} to attempt to
  263. convert parametric solutions (only) to implicit form (by eliminating
  264. the parameter). These solution conversions may be slow or may fail in
  265. complicated cases.
  266. \ODESolve{1+} introduces two operators used in solutions:
  267. \texttt{root\_of\_unity} and \texttt{plus\_or\_minus}, the latter
  268. being a special case of the former, i.e.\ a second root of unity.
  269. These operators carry a tag that associates the same root of unity
  270. when it appears in more than one place in a solution (cf.\ the
  271. standard \texttt{root\_of} operator). The ``expand'' option expands a
  272. single solution expressed in terms of these operators into a set of
  273. solutions that do not involve them. \ODESolve{1+} also introduces two
  274. operators \texttt{expand\_roots\_of\_unity} [which should perhaps be
  275. named \texttt{expand\_root\_of\_unity}] and
  276. \texttt{expand\_plus\_or\_minus}, that are used internally to perform
  277. the expansion described above, and can be used explicitly.
  278. The ``algint'' option turns on ``algebraic integration'' locally only
  279. within \ODESolve{1+}. It also loads the \texttt{algint} package if
  280. necessary. Algint allows \ODESolve{1+} to solve some ODEs for which
  281. the standard \REDUCE{} integrator hangs (i.e.\ takes an extremely long
  282. time to return). If the resulting solution contains unevaluated
  283. integrals then the algint switch should be turned on outside
  284. \ODESolve{1+} before the solution is re-evaluated, otherwise the
  285. standard integrator may well hang again! For some ODEs, the algint
  286. option leads to better solutions than the standard \REDUCE{}
  287. integrator.
  288. Alternatively, the ``noint'' option prevents \REDUCE{} from attempting
  289. to evaluate the integrals that arise in some solution techniques. If
  290. \ODESolve{1+} takes too long to return a result then you might try
  291. adding this option to see if it helps solve this particular ODE, as
  292. illustrated in the test files. This option is provided to speed up
  293. the computation of solutions that contain integrals that cannot be
  294. evaluated, because in some cases \REDUCE{} can spend a long time
  295. trying to evaluate such integrals before returning them unevaluated.
  296. This only affects integrals evaluated \emph{within} the \ODESolve{1+}
  297. operator. If a solution containing an unevaluated integral that was
  298. returned using the ``noint'' option is re-evaluated, it may again take
  299. \REDUCE{} a very long time to fail to evaluate the integral, so
  300. considerable caution is recommended! (A global switch called
  301. ``noint'' is also installed when \ODESolve{1+} is loaded, and can be
  302. turned on to prevent \REDUCE{} from attempting to evaluate \emph{any}
  303. integrals. But this effect may be very confusing, so this switch
  304. should be used only with extreme care. If you turn it on and then
  305. forget, you may wonder why \REDUCE{} seems unable to evaluate even
  306. trivial integrals!)
  307. The ``verbose'' option causes \ODESolve{1+} to display the ODE,
  308. variables and conditions as it sees them internally, after
  309. pre-processing. This is intended for use in demonstrations and
  310. possibly for debugging, and not really for general users.
  311. The ``basis'' option causes \ODESolve{1+} to output the general
  312. solutions of linear ODEs in basis format (explained below). Special
  313. solutions (of ODEs with conditions) and solutions of nonlinear ODEs
  314. are not affected.
  315. The ``trode'' (or ``trace'' or ``tracing'') option turns on tracing of
  316. the algorithms used by \ODESolve{1+}. It reports its classification
  317. of the ODE and any intermediate results that it computes, such as a
  318. chain of progressively simpler (in some sense) ODEs that finally leads
  319. to a solution. Tracing can produce a lot of output, e.g.\ see the
  320. test log file ``\texttt{zimmer.rlg}''. The option ``\texttt{trode =
  321. 1}'' or the global assignment ``\texttt{!*trode := 1}'' causes
  322. \ODESolve{1+} to report every test that it tries in its classification
  323. process, producing even more tracing output. This is probably most
  324. useful for debugging, but it may give the curious user further insight
  325. into the operation of \ODESolve{1+}.
  326. The ``fast'' option disables all non-deterministic solution techniques
  327. (including most of those for nonlinear ODEs of order $> 1$). It may
  328. be most useful if \ODESolve{1+} is used as a subroutine, including
  329. calling it recursively in a hook. It makes \ODESolve{1+} behave like
  330. the \odesolve{} distributed with \REDUCE{} versions up to and
  331. including 3.7, and so does not affect the \texttt{odesolve.tst} file.
  332. The ``fast'' option causes \ODESolve{1+} to return no solution fast in
  333. cases where, by default, if would return either a solution or no
  334. solution (perhaps much) more slowly. Solution of sufficiently simple
  335. ``deterministically-solvable'' ODEs is unaffected.
  336. The ``check'' option turns on checking of the solution. This checking
  337. is performed by code that is largely independent of the solver, so as
  338. to perform a genuinely independent check. It is not turned on by
  339. default so as to avoid the computational overhead, which is currently
  340. of the order of 30\%. A check is made that each component solution
  341. satisfies the ODE and that a general solution contains at least enough
  342. arbitrary constants, or equivalently that a basis solution contains
  343. enough basis functions. Otherwise, warning messages are output. It
  344. is possible that \ODESolve{1+} may fail to verify a solution because
  345. the automatic simplification fails, which indicates a failure in the
  346. checker rather than in the solver. This option is not yet well
  347. tested; please report any checking failures to me (FJW).
  348. In some cases, in particular when an implicit solution contains an
  349. unevaluated integral, the checker may need to differentiate an
  350. integral with respect to a variable other than the integration
  351. variable. In order to do this, it turns on the differentiator switch
  352. ``allowdfint'' globally. [I hope that this setting will eventually
  353. become the default.] In some cases, in particular in symbolic
  354. solutions of Clairaut ODEs, the checker may need to differentiate a
  355. composition of operators using the chain rule. In order to do this,
  356. it turns on the differentiator switch ``expanddf'' locally only.
  357. Although the code to support both these differentiator facilities has
  358. been in \REDUCE{} for a while, they both require patches that are
  359. currently only applied when \ODESolve{1+} is loaded. [I hope that
  360. these patches will eventually become part of \REDUCE{} itself.]
  361. \section{Output syntax}
  362. If \ODESolve{1+} is successful it outputs a list of sub-solutions that
  363. together represent the solution of the input ODE\@. Each sub-solution
  364. is either an equation that defines a branch of the solution,
  365. explicitly or implicitly, or it is a list of equations that define a
  366. branch of the solution parametrically in the form $\{y = G(p), x =
  367. F(p), p\}$. Here $p$ is the parameter, which is actually represented
  368. in terms of an operator called \texttt{arbparam} which has an integer
  369. argument to distinguish it from other unrelated parameters, as usual
  370. for arbitrary values in \REDUCE{}.
  371. A general solution will contain a number of arbitrary constants
  372. represented by an operator called \texttt{arbconst} with an integer
  373. argument to distinguish it from other unrelated arbitrary constants.
  374. A special solution resulting from applying conditions will contain
  375. fewer (usually no) arbitrary constants.
  376. The general solution of a linear ODE in basis format is a list
  377. consisting of a list of basis functions for the solution space of the
  378. reduced ODE followed by a particular solution if the input ODE had a
  379. $y$-independent ``driver'' term, i.e.\ was not reduced (which is
  380. sometimes ambiguously called ``homogeneous''). The particular
  381. solution is normally omitted if it is zero. The dependent variable
  382. $y$ does not appear in a basis solution. The linear solver uses basis
  383. solutions internally.
  384. Currently, there are cases where \ODESolve{1+} cannot solve a linear ODE
  385. using its linear solution techniques, in which case it will try
  386. nonlinear techniques. These may generate a solution that is not
  387. (obviously) a linear combination of basis solutions. In this case, if
  388. a basis solution has been requested, \ODESolve{1+} will report that it
  389. cannot separate the nonlinear combination, which it will return as the
  390. default linear combination solution.
  391. If \ODESolve{1+} fails to solve the ODE then it will return a list
  392. containing the input ODE (always in the form of a differential
  393. expression equated to 0). At present, \ODESolve{1+} does not return
  394. partial solutions. If it fails to solve any part of the problem then
  395. it regards this as complete failure. (You can probably see if this
  396. has happened by turning on algorithm tracing.)
  397. \section{Solution techniques}
  398. The \ODESolve{1+} interface module pre-processes the problem and applies
  399. any conditions to the solution. The other modules deal with the
  400. actual solution.
  401. \ODESolve{1+} first classifies the input ODE according to whether it
  402. is linear or nonlinear and calls the appropriate solver. An ODE that
  403. consists of a product of linear factors is regarded as nonlinear. The
  404. second main classification is based on whether the input ODE is of
  405. first or higher degree.
  406. Solution proceeds essentially by trying to reduce nonlinear ODEs to
  407. linear ones, and to reduce higher order ODEs to first order ODEs.
  408. Only simple linear ODEs and simple first-order nonlinear ODEs can be
  409. solved directly. This approach involves considerable recursion within
  410. \ODESolve{1+}.
  411. If all solution techniques fail then \ODESolve{1+} attempts to
  412. factorize the derivative of the whole ODE, which sometimes leads to a
  413. solution.
  414. \subsection{Linear solution techniques}
  415. \ODESolve{1+} splits every linear ODE into a ``reduced ODE'' and a
  416. ``driver'' term. The driver is the component of the ODE that is
  417. independent of $y$, the reduced ODE is the component of the ODE that
  418. depends on $y$, and the sign convention is such that the ODE can be
  419. written in the form ``reduced ODE = driver''. The reduced ODE is then
  420. split into a list of ``ODE coefficients''.
  421. The linear solver now determines the order of the ODE\@. If it is 1
  422. then the ODE is immediately solved using an integrating factor (if
  423. necessary). For a higher order linear ODE, \ODESolve{1+} considers a
  424. sequence of progressively more complicated solution techniques. For
  425. most purposes, the ODE is made ``monic'' by dividing through by the
  426. coefficient of the highest order derivative. This puts the ODE into a
  427. standard form and effectively deals with arbitrary overall algebraic
  428. factors that would otherwise confuse the solution process. (Hence,
  429. there is no need to perform explicit algebraic factorization on linear
  430. ODEs.) The only situation in which the original non-monic form of the
  431. ODE is considered is when checking for exactness, which may depend
  432. critically on otherwise irrelevant overall factors.
  433. If the ODE has constant coefficients then it can (in principle) be
  434. solved using elementary ``D-operator'' techniques in terms of
  435. exponentials via an auxiliary equation. However, this works only if
  436. the polynomial auxiliary equation can be solved. Assuming that it can
  437. and there is a driver term, \ODESolve{1+} tries to use a method based
  438. on inverse ``D-operator'' techniques that involves repeated
  439. integration of products of the solutions of the reduced ODE with the
  440. driver. Experience (by Malcolm MacCallum) suggests that this normally
  441. gives the most satisfactory form of solution if the integrals can be
  442. evaluated. If any integral fails to evaluate, the more general method
  443. of ``variation of parameters'', based on the Wronskian of the solution
  444. set of the reduced ODE, is used instead. This involves only a single
  445. integral and so can never lead to nested unevaluated integrals.
  446. If the ODE has non-constant coefficients then it may be of Euler
  447. (sometimes ambiguously called ``homogeneous'') type, which can be
  448. trivially reduced to an ODE with constant coefficients. A shift in
  449. $x$ is accommodated in this process. Next it is tested for exactness,
  450. which leads to a first integral that is an ODE of order one lower.
  451. After that it is tested for the explicit absence of $y$ and low order
  452. derivatives, which allows trivial order reduction. Then the monic ODE
  453. is tested for exactness, and if that fails and the original ODE was
  454. non-monic then the original form is tested for exactness.
  455. Finally, pattern matching is used to seek a solution involving special
  456. functions, such as Bessel functions. Currently, this is implemented
  457. only for second-order ODEs satisfied by Bessel and Airy-integral
  458. functions. It could easily be extended to other orders and other
  459. special functions. Shifts in $x$ could also be accommodated in the
  460. pattern matching. [Work to enhance this component of \ODESolve{1+} is
  461. currently in progress.]
  462. If all linear techniques fail then \ODESolve{1+} currently calls the
  463. variable interchange routine (described below), which takes it into
  464. the nonlinear solver. Occasionally, this is successful in producing
  465. some, although not necessarily the best, solution of a linear ODE.
  466. \subsection{Nonlinear solution techniques}
  467. In order to handle trivial nonlinearity, \ODESolve{1+} first
  468. factorizes the ODE algebraically, solves each factor that depends on
  469. $y$ and then merges the resulting solutions. Other factors are
  470. ignored, but a warning is output unless they are purely numerical.
  471. If all attempts at solution fail then \ODESolve{1+} checks whether the
  472. original (unfactored) ODE was exact, because factorization could
  473. destroy exactness. Currently, \ODESolve{1+} handles only first and
  474. second order nonlinear exact ODEs.
  475. A version of the main solver applied to each algebraic factor branches
  476. depending on whether the ODE factor is linear or nonlinear, and the
  477. nonlinear solver branches depending on whether the order is 1 or
  478. higher and calls one of the solvers described in the next two
  479. sections. If that solver fails, \ODESolve{1+} checks for exactness
  480. (of the factor). If that fails, it checks whether only a single order
  481. derivative is involved and tries to solve algebraically for that. If
  482. successful, this decomposes the ODE into components that are, in some
  483. sense, simpler and may be solvable. (However, in some cases these
  484. components are algebraically very complicated examples of simple types
  485. of ODE that the integrator cannot in practice handle, and it can take
  486. a very long time before returning an unevaluated integral.)
  487. If all else fails, \ODESolve{1+} interchanges the dependent and
  488. independent variables and calls the top-level solver recursively. It
  489. keeps a list of all ODEs that have entered the top-level solver in
  490. order to break infinite loops that could arise if the solution of the
  491. variable-interchanged ODE fails.
  492. \subsubsection{First-order nonlinear solution techniques}
  493. If the ODE is a first-degree polynomial in the derivative then
  494. \ODESolve{1+} represents it in terms of the ``gradient'', which is a
  495. function of $x$ and $y$ such that the ODE can be written as ``$dy/dx =
  496. \textit{gradient}$''. It then checks \emph{in sequence} for the
  497. following special types of ODE, each of which it can (in principle)
  498. solve:
  499. \begin{description}
  500. \item[Separable] The gradient has the form $f(x)g(y)$, leading
  501. immediately to a solution by quadrature, i.e.\ the solution can be
  502. immediately written in terms of indefinite integrals. (This is
  503. considered to be a solution of the ODE, regardless of whether the
  504. integrals can be evaluated.) The solver recognises both explicit and
  505. implicit dependence when detecting separable form.
  506. \item[Quasi-separable] The gradient has the form $f(y+kx)$, which is
  507. (trivially) separable after a linear transformation. It arises as a
  508. special case of the ``quasi-homogeneous'' case below, but is better
  509. treated earlier as a case in its own right.
  510. \item[Homogeneous] The gradient has the form $f(y/x)$, which is
  511. algebraically homogeneous. A substitution of the form ``$y = vx$''
  512. leads to a first-order linear ODE that is (in principle) immediately
  513. solvable.
  514. \item[Quasi-homogeneous] The gradient has the form $f(\frac{a_1x +
  515. b_1y + c_1}{a_2x + b_2y + c_2})$, which is homogeneous after a linear
  516. transformation.
  517. \item[Bernoulli] The gradient has the form $P(x) y + Q(x) y^n$, in
  518. which case the ODE is a first-order linear ODE for $y^{1-n}$.
  519. \item[Riccati] The gradient has the form $a(x)y^2 + b(x)y + c(x)$, in
  520. which case the ODE can be transformed into a \emph{linear}
  521. second-order ODE that may be solvable.
  522. \end{description}
  523. If the ODE is not first-degree then it may be linear in either $x$ or
  524. $y$. Solving by taking advantage of this leads to a parametric
  525. solution of the original ODE, in which the parameter corresponds to
  526. $y'$. It may then be possible to eliminate the parameter to give
  527. either an implicit or explicit solution.
  528. An ODE is ``solvable for $y$'' if it can be put into the form $y =
  529. f(x,y')$. Differentiating with respect to $x$ leads to a first-order
  530. ODE for $y'(x)$, which may be easier to solve than the original ODE.
  531. The special case that $y = xF(y') + G(y')$ is called a Lagrange (or
  532. d'Alembert) ODE\@. Differentiating with respect to $x$ leads to a
  533. first-order linear ODE for $x(y')$. The even more special case that
  534. $y = x y' + G(y')$, which may arise in the equivalent implicit form
  535. $F(xy'-y) = G(y')$, is called a Clairaut ODE\@. The general solution is
  536. given by replacing $y'$ by an arbitrary constant, and it may be
  537. possible to obtain a singular solution by differentiating and solving
  538. the resulting factors simultaneously with the original ODE.
  539. An ODE is ``solvable for $x$'' if it can be put into the form $x =
  540. f(y,y')$. Differentiating with respect to $y$ leads to a first-order
  541. ODE for $y'(y)$, which may be easier to solve than the original ODE.
  542. Currently, \ODESolve{1+} recognises the above forms only if the ODE
  543. manifestly has the specified form and does not try very hard to
  544. actually solve for $x$ or $y$, which perhaps it should!
  545. \subsubsection{Higher-order nonlinear solution techniques}
  546. The techniques used here are all special cases of Lie symmetry
  547. analysis, which is not yet applied in any general way.
  548. Higher-order nonlinear ODEs are passed through a number of
  549. ``simplifier'' filters that are applied in succession, regardless of
  550. whether the previous filter simplifies the ODE or not. Currently, the
  551. first filter tests for the explicit absence of $y$ and low order
  552. derivatives, which allows trivial order reduction. The second filter
  553. tests whether the ODE manifestly depends on $x+k$ for some constant
  554. $k$, in which case it shifts $x$ to remove $k$.
  555. After that, \ODESolve{1+} tests for each of the following special
  556. forms in sequence. The sequence used here is important, because the
  557. classification is not unique, so it is important to try the most
  558. useful classification first.
  559. \begin{description}
  560. \item[Autonomous] An ODE is autonomous if it does not depend
  561. explicitly on $x$, in which case it can be reduced to an ODE in $y'$
  562. of order one lower.
  563. \item[Scale invariant or equidimensional in $x$] An ODE is scale
  564. invariant if it is invariant under the transformation $x \to ax, y \to
  565. a^py$, where $a$ is an arbitrary indeterminate and $p$ is a constant
  566. to be determined. It can be reduced to an autonomous ODE, and thence
  567. to an ODE of order one lower. The special case $p = 0$ is called
  568. equidimensional in $x$. It is the nonlinear generalization of the
  569. (reduced) linear Euler ODE.
  570. \item[Equidimensional in $y$] An ODE is equidimensional in $y$ if it
  571. is invariant under the transformation $y \to ay$. An exponential
  572. transformation of $y$ leads to an ODE of the same order that
  573. \emph{may} be ``more linear'' and so easier to solve, but there is no
  574. guarantee of this. All (reduced) linear ODEs are trivially
  575. equidimensional in $y$.
  576. \end{description}
  577. The recursive nature of \ODESolve{1+}, especially the thread described
  578. in this section, can lead to complicated ``arbitrary constant
  579. expressions''. Arbitrary constants must be included at the point
  580. where an ODE is solved by quadrature. Further processing of such a
  581. solution, as may happen when a recursive solution stack is unwound,
  582. can lead to arbitrary constant expressions that should be re-written
  583. as simple arbitrary constants. There is some simple code included to
  584. perform this arbitrary constant simplification, but it is rudimentary
  585. and not entirely successful.
  586. \section{Extension interface}\label{OEI}
  587. The idea is that the ODESolve extension interface allows any user to
  588. add solution techniques without needing to edit and recompile the main
  589. source code, and (in principle) without needing to be intimately
  590. familiar with the internal operation of \ODESolve{1+}.
  591. The extension interface consists of a number of ``hooks'' at various
  592. critical places within \ODESolve{1+}. These hooks are modelled in
  593. part on the hook mechanism used to extend and customize the Emacs
  594. editor, which is a large Lisp-based system with a structure similar to
  595. that of \REDUCE\@. Each \ODESolve{1+} hook is an identifier which can
  596. be defined to be a function (i.e.\ a procedure), or have assigned to
  597. it (in symbolic mode) a function name or a (symbolic mode) list of
  598. function names. The function should be written to accept the
  599. arguments specified for the particular hook, and it should return
  600. either a solution to the specified class of ODE in the specified form
  601. or nil.
  602. If a hook returns a non-nil value then that value is used by
  603. \ODESolve{1+} as the solution of the ODE at that stage of the solution
  604. process. [If the ODE being solved was generated internally by
  605. \ODESolve{1+} or conditions are imposed then the solution will be
  606. re-processed before being finally returned by \ODESolve{1+}.] If a
  607. hook returns nil then it is ignored and \ODESolve{1+} proceeds as if
  608. the hook function had not been called at all. This is the same
  609. mechanism that it used internally by \ODESolve{1+} to run sub-solvers.
  610. If a hook evaluates to a list of function names then they are applied
  611. in turn to the hook arguments until a non-nil value is returned and
  612. this is the value of the hook; otherwise the hook returns nil. The
  613. same code is used to run all hooks and it checks that an identifier is
  614. the name of a function before it tries to apply it; otherwise the
  615. identifier is ignored. However, the hook code does not perform any
  616. other checks, so errors within functions run by hooks will probably
  617. terminate \ODESolve{1+} and errors in the return value will probably
  618. cause fatal errors later in \ODESolve{1+}. Such errors are user
  619. errors rather than \ODESolve{1+} errors!
  620. Hooks are defined in pairs which are inserted before and after
  621. critical stages of the solver, which currently means the general ODE
  622. solver, the nonlinear ODE solver, and the solver for linear ODEs of
  623. order greater than one (on the grounds that solving first order linear
  624. ODEs is trivial and the standard \ODESolve{1+} code should always
  625. suffice). The precise interface definition is as follows.
  626. A reference to an ``algebraic expression'' implies that the \REDUCE{}
  627. representation is a prefix or pseudo-prefix form. A reference to a
  628. ``variable'' means an identifier (and never a more general kernel).
  629. The ``order'' of an ODE is always an explicit positive integer. The
  630. return value of a hook function must always be either nil or an
  631. algebraic-mode list (which must be represented as a prefix form).
  632. Since the input and output of hook functions uses prefix forms (and
  633. never standard quotient forms), hook functions can equally well be
  634. written in either algebraic or symbolic mode, and in fact \ODESolve{1+}
  635. uses a mixture internally. (An algebraic-mode procedure can return
  636. nil by returning nothing. The integer zero is \emph{not} equivalent
  637. to nil in the context of \ODESolve{1+} hooks.)
  638. \noindent\hrulefill
  639. \begin{description}
  640. \item[Hook names:] \verb|ODESolve_Before_Hook|,
  641. \verb|ODESolve_After_Hook|.
  642. \item[Run before and after:] The general ODE solver.
  643. \item[Arguments:] 3
  644. \begin{enumerate}
  645. \item The ODE in the form of an algebraic expression with no
  646. denominator that must be made identically zero by the solution.
  647. \item The dependent variable.
  648. \item The independent variable.
  649. \end{enumerate}
  650. \item[Return value:] A list of equations exactly as returned by
  651. \ODESolve{1+} itself.
  652. \end{description}
  653. \noindent\hrulefill
  654. \begin{description}
  655. \item[Hook names:] \verb|ODESolve_Before_Non_Hook|,
  656. \verb|ODESolve_After_Non_Hook|.
  657. \item[Run before and after:] The nonlinear ODE solver.
  658. \item[Arguments:] 4
  659. \begin{enumerate}
  660. \item The ODE in the form of an algebraic expression with no
  661. denominator that must be made identically zero by the solution.
  662. \item The dependent variable.
  663. \item The independent variable.
  664. \item The order of the ODE.
  665. \end{enumerate}
  666. \item[Return value:] A list of equations exactly as returned by
  667. \ODESolve{1+} itself.
  668. \end{description}
  669. \noindent\hrulefill
  670. \pagebreak
  671. \begin{description}
  672. \item[Hook names:] \verb|ODESolve_Before_Lin_Hook|,
  673. \verb|ODESolve_After_Lin_Hook|.
  674. \item[Run before and after:] The general linear ODE solver.
  675. \item[Arguments:] 6
  676. \begin{enumerate}
  677. \item A list of the coefficient functions of the ``reduced ODE'',
  678. i.e.\ the coefficients of the different orders (including zero) of
  679. derivatives of the dependent variable, each in the form of an
  680. algebraic expression, in low to high derivative order. [In general
  681. the ODE will not be ``monic'' so the leading (i.e.\ last) coefficient
  682. function will not be 1. Hence, the ODE may contain an essentially
  683. irrelevant overall algebraic factor.]
  684. \item The ``driver'' term, i.e.\ the term involving only the
  685. independent variable, in the form of an algebraic expression. The
  686. sign convention is such that ``reduced ODE = driver''.
  687. \item The dependent variable.
  688. \item The independent variable.
  689. \item The (maximum) order ($> 1$) of the ODE.
  690. \item The minimum order derivative present.
  691. \end{enumerate}
  692. \item[Return value:] A list consisting of a basis for the solution
  693. space of the reduced ODE and optionally a particular integral of the
  694. full ODE\@. This list does not contain any equations, and the dependent
  695. variable never appears in it. The particular integral may be omitted
  696. if it is zero. The basis is itself a list of algebraic expressions in
  697. the independent variable. (Hence the return value is always a list
  698. and its first element is also always a list.)
  699. \end{description}
  700. \noindent\hrulefill
  701. \begin{description}
  702. \item[Hook names:] \verb|ODESolve_Before_Non1Grad_Hook|, \\
  703. \verb|ODESolve_After_Non1Grad_Hook|.
  704. \item[Run before and after:] The solver for first-order first-degree
  705. nonlinear (``gradient'') ODEs, which can be expressed in the form
  706. $dy/dx = \mathrm{gradient}(y,x)$.
  707. \item[Arguments:] 3
  708. \begin{enumerate}
  709. \item The ``gradient'', which is an algebraic expression involving (in
  710. general) the dependent and independent variables, to which the ODE
  711. equates the derivative.
  712. \item The dependent variable.
  713. \item The independent variable.
  714. \end{enumerate}
  715. \item[Return value:] A list of equations exactly as returned by
  716. \ODESolve{1+} itself. (In this case the list should normally contain
  717. precisely one equation.)
  718. \end{description}
  719. \noindent\hrulefill
  720. \bigskip
  721. The file \texttt{extend.tst} contains a very simple test and
  722. demonstration of the operation of the first three classes of hook.
  723. This extension interface is experimental and subject to change.
  724. Please check the version of this document (or the source code) for the
  725. version of \ODESolve{1+} you are actually running.
  726. \section{Change log}
  727. \begin{description}
  728. \item[27 February 1999] Version 1.06 frozen.
  729. \item[13 July 2000] Version 1.061 added an extension interface.
  730. \item[8 August 2000] Version 1.062 added the ``fast'' option.
  731. \item[21 September 2000] Version 1.063 added the ``trace'', ``check''
  732. and ``algint'' options, the ``Non1Grad'' hooks, handling of implicit
  733. dependence in separable ODEs, and handling of the general class of
  734. quasi-homogeneous ODEs.
  735. \item[28 September 2000] Version 1.064 added support for using `t' as
  736. a variable and replaced the version identification output by the
  737. \verb|odesolve_version| variable.
  738. \item[14 August 2001] Version 1.065 fixed obscure bugs in the
  739. first-order nonlinear ODE handler and the arbitrary constant
  740. simplifier, and revised some tracing messages slightly.
  741. \end{description}
  742. \section{Planned developments}
  743. \begin{itemize}
  744. \item
  745. Extend special-function solutions and allow shifts in $x$.
  746. \item
  747. Improve solution of linear ODEs, by (a) using linearity more generally
  748. to solve as ``CF + PI'', (b) finding at least polynomial solutions of
  749. ODEs with polynomial coefficients, (c) implementing non-trivial
  750. reduction of order.
  751. \item
  752. Improve recognition of exact ODEs, and add some support for more
  753. general use of integrating factors.
  754. \item
  755. Add a ``classify'' option, that turns on trode but avoids any actual
  756. solution, to report all possible (\@?) top-level classifications.
  757. \item
  758. Improve arbconst and arbparam simplification.
  759. \item
  760. Add more standard elementary techniques and more general techniques
  761. such as Lie symmetry, Prelle-Singer, etc.
  762. \item
  763. Improve integration support, preferably to remove the need for the
  764. ``noint'' option.
  765. \item
  766. Solve systems of ODEs, including under- and over-determined ODEs and
  767. systems. Link to CRACK (Wolf) and/or DiffGrob2 (Mansfield)?
  768. \item
  769. Move more of the implementation to symbolic-mode code.
  770. \end{itemize}
  771. \begin{thebibliography}{99}
  772. \bibitem{CATHODE} CATHODE (Computer Algebra Tools for Handling
  773. Ordinary Differential Equations)
  774. \href{http://www-lmc.imag.fr/CATHODE/}%
  775. {\texttt{http://www-lmc.imag.fr/CATHODE/}},
  776. \href{http://www-lmc.imag.fr/CATHODE2/}%
  777. {\texttt{http://www-lmc.imag.fr/CATHODE2/}}.
  778. \bibitem{Hearn-manual} A. C. Hearn and J. P. Fitch (ed.),
  779. \textit{REDUCE User's Manual 3.6}, RAND Publication CP78 (Rev. 7/95),
  780. RAND, Santa Monica, CA 90407-2138, USA (1995).
  781. \bibitem{MacCallum-ISSAC} M. A. H. MacCallum, An Ordinary Differential
  782. Equation Solver for REDUCE, \textit{Proc.\ ISSAC~'88, ed.\ P. Gianni,
  783. Lecture Notes in Computer Science} \textbf{358}, Springer-Verlag
  784. (1989), 196--205.
  785. \bibitem{MacCallum-doc} M. A. H. MacCallum, ODESOLVE, \LaTeX{} file
  786. \texttt{reduce/doc/odesolve.tex} distributed with \REDUCE~3.6. The
  787. first part of this document is included in the printed REDUCE User's
  788. Manual 3.6 \cite{Hearn-manual}, 345--346.
  789. \bibitem{Man} Y.-K. Man, \textit{Algorithmic Solution of ODEs and
  790. Symbolic Summation using Computer Algebra}, PhD Thesis, School of
  791. Mathematical Sciences, Queen Mary and Westfield College, University of
  792. London (July 1994).
  793. \bibitem{Man-MacCallum} Y.-K. Man and M. A. H. MacCallum, A Rational
  794. Approach to the Prelle-Singer Algorithm, \textit{J. Symbolic
  795. Computation}, \textbf{24} (1997), 31--43.
  796. \bibitem{Zimmermann} F. Postel and P. Zimmermann, A Review of the ODE
  797. Solvers of \textsc{Axiom}, \textsc{Derive}, \textsc{Maple},
  798. \textsc{Mathematica}, \textsc{Macsyma}, \textsc{MuPAD} and
  799. \textsc{Reduce}, \textit{Proceedings of the 5th Rhine Workshop on
  800. Computer Algebra, April 1-3, 1996, Saint-Louis, France.}
  801. Specific references are to the version dated April 11, 1996.
  802. The latest version of this review, together with log files for each of
  803. the systems, is available from
  804. \href{http://www.loria.fr/~zimmerma/ComputerAlgebra/}%
  805. {\texttt{http://www.loria.fr/\textasciitilde zimmerma/ComputerAlgebra/}}.
  806. \bibitem{Prelle-Singer} M. J. Prelle and M. F. Singer, Elementary
  807. First Integrals of Differential Equations, \textit{Trans.\ AMS}
  808. \textbf{279} (1983), 215--229.
  809. \bibitem{CRACK-doc} T. Wolf and A. Brand, The Computer Algebra Package
  810. \texttt{CRACK} for Investigating PDEs, \LaTeX{} file
  811. \texttt{reduce/doc/crack.tex} distributed with \REDUCE~3.6. A shorter
  812. document is included in the printed REDUCE User's Manual 3.6
  813. \cite{Hearn-manual}, 241--244.
  814. \bibitem{FJW1} F. J. Wright, An Enhanced ODE Solver for REDUCE.
  815. \textit{Programmirovanie} No 3 (1997), 5--22, in Russian, and
  816. \textit{Programming and Computer Software} No 3 (1997), in English.
  817. \bibitem{FJW2} F. J. Wright, Design and Implementation of
  818. \ODESolve{1+} : An Enhanced REDUCE ODE Solver. CATHODE Workshop
  819. Report, Marseilles, May 1999, CATHODE (1999). \\
  820. \href{http://centaur.maths.qmw.ac.uk/Papers/Marseilles/}%
  821. {\texttt{http://centaur.maths.qmw.ac.uk/Papers/Marseilles/}}.
  822. \bibitem{Zwillinger} D. Zwillinger, \textit{Handbook of Differential
  823. Equations}, Academic Press. (Second edition 1992.)
  824. \end{thebibliography}
  825. \end{document}