Boole's rule: Difference between revisions
mNo edit summary |
Citation bot (talk | contribs) Added issue. | Use this bot. Report bugs. | Suggested by Dominic3203 | Category:Numerical analysis | #UCB_Category 116/235 |
||
(45 intermediate revisions by 15 users not shown) | |||
Line 1: | Line 1: | ||
{{Short description|Method of numerical integration}} |
|||
{{hatnote|The widely propagated typographical error Bode's rule redirects here. For Bode's Law, see [[Titius–Bode law]].}} |
{{hatnote|The widely propagated typographical error Bode's rule redirects here. For Bode's Law, see [[Titius–Bode law]].}} |
||
In mathematics, '''Boole's rule''', named after [[George Boole]], is a method of [[numerical integration]]. It approximates an integral |
|||
In [[mathematics]], '''Boole's rule''', named after [[George Boole]], is a method of [[numerical integration]]. |
|||
: <math> \int_{x_1}^{x_5} f(x)\,dx </math> |
|||
==Formula== |
|||
by using the values of ''ƒ'' at five equally spaced points |
|||
===Simple Boole's Rule=== |
|||
It approximates an integral: |
|||
<math display="block"> \int_{a}^{b} f(x)\,dx </math> |
|||
by using the values of {{mvar|f}} at five equally spaced points:{{sfn|Boole|1880|p=47|loc=Eq(21)}} |
|||
<math display="block">\begin{align} |
|||
& x_0 = a\\ |
|||
& x_1 = x_0 + h \\ |
|||
& x_2 = x_0 + 2h \\ |
|||
& x_3 = x_0 + 3h \\ |
|||
& x_4 = x_0 + 4h = b |
|||
\end{align}</math> |
|||
It is expressed thus in [[Abramowitz and Stegun]]:{{sfn|Davis|Polonsky|1983}} |
|||
: <math> x_1, \quad x_2 = x_1 + h, \quad x_3 = x_1 + 2h, \quad x_4 = x_1 + 3h, \quad x_5 = x_1 +4h. \, </math> |
|||
<math display="block"> \int_{x_0}^{x_4} f(x)\,dx = \frac{2 h}{45}\bigl[ 7f(x_0) + 32 f(x_1) + 12 f(x_2) + 32 f(x_3) + 7f(x_4) \bigr] + \text{error term}</math> |
|||
where the error term is |
|||
<math display="block"> -\,\frac{8f^{(6)}(\xi)h^7}{945} </math> |
|||
for some number {{tmath|\xi}} between {{tmath|x_0}} and {{tmath|x_4}} where {{nowrap|1=945 = 1 × 3 × 5 × 7 × 9}}. |
|||
It is |
It is often known as Bode's rule, due to a typographical error that propagated from Abramowitz and Stegun.{{sfn|Weisstein}} |
||
The following constitutes a very simple implementation of the method in [[Common Lisp]] which ignores the error term: |
|||
: <math> \int_{x_1}^{x_5} f(x)\,dx = \frac{2 h}{45}\left( 7f(x_1) + 32 f(x_2) + 12 f(x_3) + 32 f(x_4) + 7f(x_5) \right) + \text{error term}, </math> |
|||
<syntaxhighlight lang="lisp"> |
|||
and the error term is |
|||
(defun integrate-booles-rule (f x1 x5) |
|||
"Calculates the Boole's rule numerical integral of the function F in |
|||
the closed interval extending from inclusive X1 to inclusive X5 |
|||
without error term inclusion." |
|||
(declare (type (function (real) real) f)) |
|||
(declare (type real x1 x5)) |
|||
(let ((h (/ (- x5 x1) 4))) |
|||
(declare (type real h)) |
|||
(let* ((x2 (+ x1 h)) |
|||
(x3 (+ x2 h)) |
|||
(x4 (+ x3 h))) |
|||
(declare (type real x2 x3 x4)) |
|||
(* (/ (* 2 h) 45) |
|||
(+ (* 7 (funcall f x1)) |
|||
(* 32 (funcall f x2)) |
|||
(* 12 (funcall f x3)) |
|||
(* 32 (funcall f x4)) |
|||
(* 7 (funcall f x5))))))) |
|||
</syntaxhighlight> |
|||
=== Composite Boole's Rule === |
|||
: <math> -\,\frac{8}{945} h^7 f^{(6)}(c) </math> |
|||
In cases where the integration is permitted to extend over equidistant sections of the interval <math>[a, b]</math>, the composite Boole's rule might be applied. Given <math>N</math> divisions, where <math>N</math> [[Modulo|mod]] <math>4 = 0</math>, the integrated value amounts to:{{sfn|Sablonnière|Sbibih|Tahrichi|2010|p=852}} |
|||
<math display=block> |
|||
for some number ''c'' between ''x''<sub>1</sub> and ''x''<sub>5</sub>. (945 = 1 × 3 × 5 × 7 × 9.) |
|||
\int_{x_0}^{x_N} f(x)\,dx |
|||
= \frac{2 h}{45} |
|||
\left( |
|||
7(f(x_0) + f(x_N)) |
|||
+ 32\left(\sum_{i \in \{1, 3, 5, \ldots, N-1\}} f(x_i)\right) |
|||
+ 12\left(\sum_{i \in \{2, 6, 10, \ldots, N-2\}} f(x_i)\right) |
|||
+ 14\left(\sum_{i \in \{4, 8, 12, \ldots, N-4\}} f(x_i)\right) |
|||
\right) + \text{error term} |
|||
</math> |
|||
where the error term is similar to above. The following Common Lisp code implements the aforementioned formula: |
|||
It is often known as Bode's rule, due to a typographical error that propagated from [[Abramowitz and Stegun]] (1972, p. 886).<ref>{{MathWorld |title=Boole's Rule|id=BoolesRule}}</ref><ref name="Abramowitz_1972">{{AS ref|25.4.14: Numerical Interpolation, Differentiation, and Integration - Integration - Numerical Analysis|886|first1=Ruth|last1=Zucker}}</ref> |
|||
<syntaxhighlight lang="lisp"> |
|||
(defun integrate-composite-booles-rule (f a b n) |
|||
"Calculates the composite Boole's rule numerical integral of the |
|||
function F in the closed interval extending from inclusive A to |
|||
inclusive B across N subintervals." |
|||
(declare (type (function (real) real) f)) |
|||
(declare (type real a b)) |
|||
(declare (type (integer 1 *) n)) |
|||
(let ((h (/ (- b a) n))) |
|||
(declare (type real h)) |
|||
(flet ((f[i] (i) |
|||
(declare (type (integer 0 *) i)) |
|||
(let ((xi (+ a (* i h)))) |
|||
(declare (type real xi)) |
|||
(the real (funcall f xi))))) |
|||
(* (/ (* 2 h) 45) |
|||
(+ (* 7 (+ (f[i] 0) (f[i] n))) |
|||
(* 32 (loop for i from 1 to (- n 1) by 2 sum (f[i] i))) |
|||
(* 12 (loop for i from 2 to (- n 2) by 4 sum (f[i] i))) |
|||
(* 14 (loop for i from 4 to (- n 4) by 4 sum (f[i] i)))))))) |
|||
</syntaxhighlight> |
|||
==See also== |
==See also== |
||
Line 25: | Line 91: | ||
* [[Romberg's method]] |
* [[Romberg's method]] |
||
== |
==Notes== |
||
{{reflist}} |
{{reflist}} |
||
==References== |
|||
{{sfn whitelist|CITEREFDavisPolonsky1983|CITEREFWeisstein}} |
|||
* {{cite book |
|||
|last= Boole |
|||
|first= George |
|||
|author-link= George Boole |
|||
|year=1880 |
|||
|orig-year=1860 |
|||
|edition = 3rd |
|||
|title=A Treatise on the Calculus of Finite Differences |
|||
|url=https://archive.org/details/cu31924031240934/page/n61/mode/2up?q=7 |
|||
|publisher=[[Macmillan Publishers|Macmillan and Company]] |
|||
}} |
|||
* {{AS ref|25, eqn 25.4.14|886|first1=Philip J. |last1=Davis |link1=Philip J. Davis |first2=Ivan |last2=Polonsky}} |
|||
* {{cite journal |
|||
| last1 = Sablonnière |
|||
| first1 = P. |
|||
| last2 = Sbibih |
|||
| first2 = D. |
|||
| last3 = Tahrichi |
|||
| first3 = M. |
|||
| date = 2010 |
|||
| title = Error estimate and extrapolation of a quadrature formula derived from a quartic spline quasi-interpolant |
|||
| journal = BIT Numerical Mathematics |
|||
| volume = 50 |
|||
| issue = 4 |
|||
| pages = 843{{ndash}}862 |
|||
| doi = 10.1007/s10543-010-0278-0 |
|||
}} |
|||
* {{MathWorld |title=Boole's Rule|id=BoolesRule}} |
|||
{{Numerical integration}} |
|||
{{DEFAULTSORT:Boole's Rule}} |
{{DEFAULTSORT:Boole's Rule}} |
||
[[Category:Integral calculus]] |
|||
[[Category:Numerical analysis]] |
|||
[[Category:Numerical integration (quadrature)]] |
[[Category:Numerical integration (quadrature)]] |
||
[[Category:Articles with example Lisp (programming language) code]] |
|||
{{mathapplied-stub}} |
Latest revision as of 16:51, 28 September 2024
In mathematics, Boole's rule, named after George Boole, is a method of numerical integration.
Formula
[edit]Simple Boole's Rule
[edit]It approximates an integral: by using the values of f at five equally spaced points:[1]
It is expressed thus in Abramowitz and Stegun:[2] where the error term is for some number between and where 945 = 1 × 3 × 5 × 7 × 9.
It is often known as Bode's rule, due to a typographical error that propagated from Abramowitz and Stegun.[3]
The following constitutes a very simple implementation of the method in Common Lisp which ignores the error term:
(defun integrate-booles-rule (f x1 x5)
"Calculates the Boole's rule numerical integral of the function F in
the closed interval extending from inclusive X1 to inclusive X5
without error term inclusion."
(declare (type (function (real) real) f))
(declare (type real x1 x5))
(let ((h (/ (- x5 x1) 4)))
(declare (type real h))
(let* ((x2 (+ x1 h))
(x3 (+ x2 h))
(x4 (+ x3 h)))
(declare (type real x2 x3 x4))
(* (/ (* 2 h) 45)
(+ (* 7 (funcall f x1))
(* 32 (funcall f x2))
(* 12 (funcall f x3))
(* 32 (funcall f x4))
(* 7 (funcall f x5)))))))
Composite Boole's Rule
[edit]In cases where the integration is permitted to extend over equidistant sections of the interval , the composite Boole's rule might be applied. Given divisions, where mod , the integrated value amounts to:[4]
where the error term is similar to above. The following Common Lisp code implements the aforementioned formula:
(defun integrate-composite-booles-rule (f a b n)
"Calculates the composite Boole's rule numerical integral of the
function F in the closed interval extending from inclusive A to
inclusive B across N subintervals."
(declare (type (function (real) real) f))
(declare (type real a b))
(declare (type (integer 1 *) n))
(let ((h (/ (- b a) n)))
(declare (type real h))
(flet ((f[i] (i)
(declare (type (integer 0 *) i))
(let ((xi (+ a (* i h))))
(declare (type real xi))
(the real (funcall f xi)))))
(* (/ (* 2 h) 45)
(+ (* 7 (+ (f[i] 0) (f[i] n)))
(* 32 (loop for i from 1 to (- n 1) by 2 sum (f[i] i)))
(* 12 (loop for i from 2 to (- n 2) by 4 sum (f[i] i)))
(* 14 (loop for i from 4 to (- n 4) by 4 sum (f[i] i))))))))
See also
[edit]Notes
[edit]- ^ Boole 1880, p. 47, Eq(21).
- ^ Davis & Polonsky 1983.
- ^ Weisstein.
- ^ Sablonnière, Sbibih & Tahrichi 2010, p. 852.
References
[edit]- Boole, George (1880) [1860]. A Treatise on the Calculus of Finite Differences (3rd ed.). Macmillan and Company.
- Davis, Philip J.; Polonsky, Ivan (1983) [June 1964]. "Chapter 25, eqn 25.4.14". In Abramowitz, Milton; Stegun, Irene Ann (eds.). Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. Applied Mathematics Series. Vol. 55 (Ninth reprint with additional corrections of tenth original printing with corrections (December 1972); first ed.). Washington D.C.; New York: United States Department of Commerce, National Bureau of Standards; Dover Publications. p. 886. ISBN 978-0-486-61272-0. LCCN 64-60036. MR 0167642. LCCN 65-12253.
- Sablonnière, P.; Sbibih, D.; Tahrichi, M. (2010). "Error estimate and extrapolation of a quadrature formula derived from a quartic spline quasi-interpolant". BIT Numerical Mathematics. 50 (4): 843–862. doi:10.1007/s10543-010-0278-0.
- Weisstein, Eric W. "Boole's Rule". MathWorld.