Mercurial > octave-nkf
comparison doc/interpreter/quad.txi @ 19630:0e1f5a750d00
maint: Periodic merge of gui-release to default.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 20 Jan 2015 10:24:46 -0500 |
parents | 0850b5212619 446c46af4b42 |
children | 4197fc428c7d |
comparison
equal
deleted
inserted
replaced
19626:37d37297acf8 | 19630:0e1f5a750d00 |
---|---|
4 @c | 4 @c |
5 @c Octave is free software; you can redistribute it and/or modify it | 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 | 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 | 7 @c Free Software Foundation; either version 3 of the License, or (at |
8 @c your option) any later version. | 8 @c your option) any later version. |
9 @c | 9 @c |
10 @c Octave is distributed in the hope that it will be useful, but WITHOUT | 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 | 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 | 12 @c FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
13 @c for more details. | 13 @c for more details. |
14 @c | 14 @c |
15 @c You should have received a copy of the GNU General Public License | 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 | 16 @c along with Octave; see the file COPYING. If not, see |
17 @c <http://www.gnu.org/licenses/>. | 17 @c <http://www.gnu.org/licenses/>. |
18 | 18 |
19 @node Numerical Integration | 19 @node Numerical Integration |
167 | 167 |
168 Sometimes one does not have the function, but only the raw (x, y) points from | 168 Sometimes one does not have the function, but only the raw (x, y) points from |
169 which to perform an integration. This can occur when collecting data in an | 169 which to perform an integration. This can occur when collecting data in an |
170 experiment. The @code{trapz} function can integrate these values as shown in | 170 experiment. The @code{trapz} function can integrate these values as shown in |
171 the following example where "data" has been collected on the cosine function | 171 the following example where "data" has been collected on the cosine function |
172 over the range [0, pi/2). | 172 over the range [0, pi/2). |
173 | 173 |
174 @example | 174 @example |
175 @group | 175 @group |
176 x = 0:0.1:pi/2; # Uniformly spaced points | 176 x = 0:0.1:pi/2; # Uniformly spaced points |
177 y = cos (x); | 177 y = cos (x); |
179 @result{} 0.99666 | 179 @result{} 0.99666 |
180 @end group | 180 @end group |
181 @end example | 181 @end example |
182 | 182 |
183 The answer is reasonably close to the exact value of 1. Ordinary quadrature | 183 The answer is reasonably close to the exact value of 1. Ordinary quadrature |
184 is sensitive to the characteristics of the integrand. Empirical integration | 184 is sensitive to the characteristics of the integrand. Empirical integration |
185 depends not just on the integrand, but also on the particular points chosen to | 185 depends not just on the integrand, but also on the particular points chosen to |
186 represent the function. Repeating the example above with the sine function | 186 represent the function. Repeating the example above with the sine function |
187 over the range [0, pi/2) produces far inferior results. | 187 over the range [0, pi/2) produces far inferior results. |
188 | 188 |
189 @example | 189 @example |