Mercurial > hg > octave-nkf
comparison doc/interpreter/quad.txi @ 7984:bbaa5d7d0143
Some documentation updates
author | David Bateman <dbateman@free.fr> |
---|---|
date | Mon, 28 Jul 2008 15:47:40 +0200 |
parents | fd42779a8428 |
children | 23c248d415b5 |
comparison
equal
deleted
inserted
replaced
7983:91d020444da7 | 7984:bbaa5d7d0143 |
---|---|
48 Numerical integration based on Gaussian quadrature. | 48 Numerical integration based on Gaussian quadrature. |
49 | 49 |
50 @item quadl | 50 @item quadl |
51 Numerical integration using an adaptive Lobatto rule. | 51 Numerical integration using an adaptive Lobatto rule. |
52 | 52 |
53 @item quadgk | |
54 Numerical integration using an adaptive Guass-Konrod rule. | |
55 | |
56 @item quadv | |
57 Numerical integration using an adaptive vectorized Simpson's rule. | |
58 | |
53 @item trapz | 59 @item trapz |
54 Numerical integration using the trapezoidal method. | 60 Numerical integration using the trapezoidal method. |
55 @end table | 61 @end table |
56 | 62 |
57 @noindent | 63 @noindent |
115 Although @code{quad} returns a nonzero value for @var{ier}, the result | 121 Although @code{quad} returns a nonzero value for @var{ier}, the result |
116 is reasonably accurate (to see why, examine what happens to the result | 122 is reasonably accurate (to see why, examine what happens to the result |
117 if you move the lower bound to 0.1, then 0.01, then 0.001, etc.). | 123 if you move the lower bound to 0.1, then 0.01, then 0.001, etc.). |
118 | 124 |
119 @DOCSTRING(quadl) | 125 @DOCSTRING(quadl) |
126 | |
127 @DOCSTRING(quadgk) | |
128 | |
129 @DOCSTRING(quadv) | |
120 | 130 |
121 @DOCSTRING(trapz) | 131 @DOCSTRING(trapz) |
122 | 132 |
123 @DOCSTRING(cumtrapz) | 133 @DOCSTRING(cumtrapz) |
124 | 134 |
171 @end example | 181 @end example |
172 | 182 |
173 @node Functions of Multiple Variables | 183 @node Functions of Multiple Variables |
174 @section Functions of Multiple Variables | 184 @section Functions of Multiple Variables |
175 | 185 |
176 Octave does not have built-in functions for computing the integral | 186 Octave does not have built-in functions for computing the integral of |
177 of functions of multiple variables. It is however possible to compute | 187 functions of multiple variables directly. It is however possible to |
178 the integral of a function of multiple variables using the functions | 188 compute the integral of a function of multiple variables using the |
179 for one-dimensional integrals. | 189 functions for one-dimensional integrals. |
180 | 190 |
181 To illustrate how the integration can be performed, we will integrate | 191 To illustrate how the integration can be performed, we will integrate |
182 the function | 192 the function |
183 @iftex | 193 @iftex |
184 @tex | 194 @tex |
213 | 223 |
214 I = quadl("g", 0, 1) | 224 I = quadl("g", 0, 1) |
215 @result{} 0.30022 | 225 @result{} 0.30022 |
216 @end example | 226 @end example |
217 | 227 |
228 The above process can be simplified with the @code{dblquad} and | |
229 @code{triplequad} functions for integrals over two and three | |
230 variables. For example | |
231 | |
232 @example | |
233 I = dblquad (@(x, y) sin(pi.*x.*y).*sqrt(x.*y), 0, 1, 0, 1) | |
234 @result{} 0.30022 | |
235 @end example | |
236 | |
237 @DOCSTRING(dblquad) | |
238 | |
239 @DOCSTRING(triplequad) | |
240 | |
218 The above mentioned approach works but is fairly slow, and that problem | 241 The above mentioned approach works but is fairly slow, and that problem |
219 increases exponentially with the dimensionality the problem. Another | 242 increases exponentially with the dimensionality the problem. Another |
220 possible solution is to use Orthogonal Collocation as described in the | 243 possible solution is to use Orthogonal Collocation as described in the |
221 previous section. The integral of a function @math{f(x,y)} for | 244 previous section. The integral of a function @math{f(x,y)} for |
222 @math{x} and @math{y} between 0 and 1 can be approximated using @math{n} | 245 @math{x} and @math{y} between 0 and 1 can be approximated using @math{n} |
248 of the approximation. If the integration needs to be performed between | 271 of the approximation. If the integration needs to be performed between |
249 @math{a} and @math{b} instead of 0 and 1, a change of variables is needed. | 272 @math{a} and @math{b} instead of 0 and 1, a change of variables is needed. |
250 | 273 |
251 | 274 |
252 | 275 |
253 |