Mercurial > octave-nkf
annotate doc/interpreter/diffeq.txi @ 8828:8463d1a2e544
Doc fixes.
* 2]$$. => 2].$$
* @var{extrapval} => @var{extrapval}.
* call helloworld.oct => called @file{helloworld.oct}
* @itemize => @table @code
* shows. => shows:
* save => @code{save}
* @ref{Breakpoints} => @pxref{Breakpoints}
* add @noindent following example
* which is computed => and compute it
* clarify wording
* remove comma
* good => well
* set => number
* by writing => with the command
* has the option of directly calling => can call
* [-like-] {+of the right size,+}
* solvers => routines
* handle => test for
* add introductory section
* add following
* {+the+} [0..bitmax] => [0,bitmax]
* of the => with
* number => value
* add usual
* Besides when doing comparisons, logical => Logical {+also+}
* array comparison => array, comparisons
* param => parameter
* works very similar => is similar
* strings, => strings
* most simple => simplest
* easier => more easily
* like => as
* called => called,
* clarify wording
* you should simply type => use
* clarify wording
* means => way
* equally => also
* [-way much-] {+way+}
* add with mean value parameter given by the first argument, @var{l}
* add Functions described as @dfn{mapping functions} apply the given
operation to each element when given a matrix argument.
* in this brief introduction => here
* It is worth noticing => Note
* add following
* means => ways
author | Brian Gough <bjg@network-theory.co.uk> |
---|---|
date | Fri, 20 Feb 2009 11:17:01 -0500 |
parents | 6f2d95255911 |
children | eb63fbe60fab |
rev | line source |
---|---|
6778 | 1 @c Copyright (C) 1996, 1997, 2007 John W. Eaton |
7018 | 2 @c |
3 @c This file is part of Octave. | |
4 @c | |
5 @c Octave is free software; you can redistribute it and/or modify it | |
6 @c under the terms of the GNU General Public License as published by the | |
7 @c Free Software Foundation; either version 3 of the License, or (at | |
8 @c your option) any later version. | |
9 @c | |
10 @c Octave is distributed in the hope that it will be useful, but WITHOUT | |
11 @c ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
12 @c FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
13 @c for more details. | |
14 @c | |
15 @c You should have received a copy of the GNU General Public License | |
16 @c along with Octave; see the file COPYING. If not, see | |
17 @c <http://www.gnu.org/licenses/>. | |
3294 | 18 |
4167 | 19 @node Differential Equations |
3294 | 20 @chapter Differential Equations |
21 | |
6700 | 22 Octave has built-in functions for solving ordinary differential equations, |
23 and differential-algebraic equations. | |
8828 | 24 All solvers are based on reliable ODE routines written in Fortran. |
3294 | 25 |
26 @menu | |
27 * Ordinary Differential Equations:: | |
28 * Differential-Algebraic Equations:: | |
29 @end menu | |
30 | |
31 @cindex Differential Equations | |
32 @cindex ODE | |
33 @cindex DAE | |
34 | |
4167 | 35 @node Ordinary Differential Equations |
3294 | 36 @section Ordinary Differential Equations |
37 | |
38 The function @code{lsode} can be used to solve ODEs of the form | |
39 @iftex | |
40 @tex | |
41 $$ | |
42 {dx\over dt} = f (x, t) | |
43 $$ | |
44 @end tex | |
45 @end iftex | |
46 @ifinfo | |
47 | |
48 @example | |
49 dx | |
50 -- = f (x, t) | |
51 dt | |
52 @end example | |
53 @end ifinfo | |
54 | |
55 @noindent | |
56 using Hindmarsh's ODE solver @sc{Lsode}. | |
57 | |
6700 | 58 |
59 | |
3373 | 60 @DOCSTRING(lsode) |
3294 | 61 |
4115 | 62 @DOCSTRING(lsode_options) |
63 | |
3294 | 64 Here is an example of solving a set of three differential equations using |
65 @code{lsode}. Given the function | |
66 | |
67 @cindex oregonator | |
68 | |
69 @example | |
70 @group | |
71 function xdot = f (x, t) | |
72 | |
73 xdot = zeros (3,1); | |
74 | |
75 xdot(1) = 77.27 * (x(2) - x(1)*x(2) + x(1) \ | |
76 - 8.375e-06*x(1)^2); | |
77 xdot(2) = (x(3) - x(1)*x(2) - x(2)) / 77.27; | |
78 xdot(3) = 0.161*(x(1) - x(3)); | |
79 | |
80 endfunction | |
81 @end group | |
82 @end example | |
83 | |
84 @noindent | |
85 and the initial condition @code{x0 = [ 4; 1.1; 4 ]}, the set of | |
86 equations can be integrated using the command | |
87 | |
88 @example | |
89 @group | |
90 t = linspace (0, 500, 1000); | |
91 | |
92 y = lsode ("f", x0, t); | |
93 @end group | |
94 @end example | |
95 | |
96 If you try this, you will see that the value of the result changes | |
97 dramatically between @var{t} = 0 and 5, and again around @var{t} = 305. | |
98 A more efficient set of output points might be | |
99 | |
100 @example | |
101 @group | |
102 t = [0, logspace (-1, log10(303), 150), \ | |
103 logspace (log10(304), log10(500), 150)]; | |
104 @end group | |
105 @end example | |
106 | |
107 See Alan C. Hindmarsh, @cite{ODEPACK, A Systematized Collection of ODE | |
108 Solvers}, in Scientific Computing, R. S. Stepleman, editor, (1983) for | |
109 more information about the inner workings of @code{lsode}. | |
110 | |
4167 | 111 @node Differential-Algebraic Equations |
3294 | 112 @section Differential-Algebraic Equations |
113 | |
4115 | 114 The function @code{daspk} can be used to solve DAEs of the form |
3294 | 115 @iftex |
116 @tex | |
117 $$ | |
118 0 = f (\dot{x}, x, t), \qquad x(t=0) = x_0, \dot{x}(t=0) = \dot{x}_0 | |
119 $$ | |
120 @end tex | |
121 @end iftex | |
6700 | 122 @ifnottex |
3294 | 123 |
124 @example | |
125 0 = f (x-dot, x, t), x(t=0) = x_0, x-dot(t=0) = x-dot_0 | |
126 @end example | |
6700 | 127 @end ifnottex |
3294 | 128 |
129 @noindent | |
6700 | 130 where |
131 @iftex | |
132 @tex | |
133 $\dot{x} = {dx \over dt}$ | |
134 @end tex | |
135 @end iftex | |
136 @ifnottex | |
137 @math{x-dot} | |
138 @end ifnottex | |
139 is the derivative of @math{x}. The equation is solved using Petzold's | |
140 DAE solver @sc{Daspk}. | |
4115 | 141 |
142 @DOCSTRING(daspk) | |
143 | |
144 @DOCSTRING(daspk_options) | |
3294 | 145 |
4115 | 146 Octave also includes @sc{Dassl}, an earlier version of @var{Daspk}, |
147 and @var{dasrt}, which can be used to solve DAEs with constraints | |
148 (stopping conditions). | |
3294 | 149 |
8286
6f2d95255911
fix @seealso references to point to existing anchors
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7018
diff
changeset
|
150 @DOCSTRING(dassl) |
6f2d95255911
fix @seealso references to point to existing anchors
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7018
diff
changeset
|
151 |
6f2d95255911
fix @seealso references to point to existing anchors
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7018
diff
changeset
|
152 @DOCSTRING(dassl_options) |
6f2d95255911
fix @seealso references to point to existing anchors
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7018
diff
changeset
|
153 |
4115 | 154 @DOCSTRING(dasrt) |
155 | |
156 @DOCSTRING(dasrt_options) | |
3294 | 157 |
158 See K. E. Brenan, et al., @cite{Numerical Solution of Initial-Value | |
159 Problems in Differential-Algebraic Equations}, North-Holland (1989) for | |
160 more information about the implementation of @sc{Dassl}. |