Simpson's 3/8 Rule - Maple Programming Help

# Online Help

###### All Products    Maple    MapleSim

Home : Support : Online Help : Education : Student Package : Calculus 1 : Visualization : Integration : Student/Calculus1/Simpson38

Simpson's 3/8 Rule

 Calling Sequence ApproximateInt(f(x), x = a..b, method = simpson[3/8], opts) ApproximateInt(f(x), a..b, method = simpson[3/8], opts) ApproximateInt(Int(f(x), x = a..b), method = simpson[3/8], opts)

Parameters

 f(x) - algebraic expression in variable 'x' x - name; specify the independent variable a, b - algebraic expressions; specify the interval opts - equation(s) of the form option=value where option is one of boxoptions, functionoptions, iterations, method, outline, output, partition, pointoptions, refinement, showarea, showfunction, showpoints, subpartition, view, or Student plot options; specify output options

Description

 • The ApproximateInt(f(x), x = a..b, method = simpson[3/8], opts) command approximates the integral of f(x) from a to b by using Simpson's 3/8 rule.  This rule is also known as Newton's 3/8 rule. The first two arguments (function expression and range) can be replaced by a definite integral.
 • If the independent variable can be uniquely determined from the expression, the parameter x need not be included in the calling sequence.
 • Given a partition $P=\left(a={x}_{0},{x}_{1},...,{x}_{N}=b\right)$ of the interval $\left(a,b\right)$, Simpson's 3/8 rule approximates the integral on each subinterval $\left({x}_{i-1},{x}_{i}\right)$ by integrating the cubic function that interpolates the four points $\left({x}_{i-1},f\left({x}_{i-1}\right)\right)$, $\left(\frac{2}{3}{x}_{i-1}+\frac{1}{3}{x}_{i},f\left(\frac{2}{3}{x}_{i-1}+\frac{1}{3}{x}_{i}\right)\right)$, $\left(\frac{1}{3}{x}_{i-1}+\frac{2}{3}{x}_{i},f\left(\frac{1}{3}{x}_{i-1}+\frac{2}{3}{x}_{i}\right)\right)$, and $\left({x}_{i},f\left({x}_{i}\right)\right)$.  This value is

$\frac{1}{8}\left({x}_{i}-{x}_{i-1}\right)\left(f\left({x}_{i-1}\right)+3f\left(\frac{2}{3}{x}_{i-1}+\frac{1}{3}{x}_{i}\right)+3f\left(\frac{1}{3}{x}_{i-1}+\frac{2}{3}{x}_{i}\right)+f\left({x}_{i}\right)\right)$

 • In the case that the widths of the subintervals are equal, the approximation can be written as

$\frac{1}{8}\frac{\left(b-a\right)\left(f\left({x}_{0}\right)+3f\left(\frac{2}{3}{x}_{0}+\frac{1}{3}{x}_{1}\right)+3f\left(\frac{1}{3}{x}_{0}+\frac{2}{3}{x}_{1}\right)+2f\left({x}_{1}\right)+3f\left(\frac{2}{3}{x}_{1}+\frac{1}{3}{x}_{2}\right)+3f\left(\frac{1}{3}{x}_{1}+\frac{2}{3}{x}_{2}\right)+2f\left({x}_{2}\right)+\mathrm{...}+f\left(\frac{1}{3}{x}_{N-1}+\frac{2}{3}{x}_{N}\right)+f\left({x}_{N}\right)\right)}{N}$

 Traditionally, Simpson's 3/8 rule is written as: given N, where N is a positive multiple of 3, and given equally spaced points $a={x}_{0},{x}_{1},{x}_{2},...,{x}_{N}=b$, an approximation to the integral ${∫}_{a}^{b}f\left(x\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}ⅆx$ is

$\frac{3}{8}\frac{\left(b-a\right)\left(f\left({x}_{0}\right)+3f\left({x}_{1}\right)+3f\left({x}_{2}\right)+2f\left({x}_{3}\right)+3f\left({x}_{4}\right)+3f\left({x}_{5}\right)+2f\left({x}_{6}\right)+3f\left({x}_{7}\right)+\mathrm{...}+3f\left({x}_{N-1}\right)+f\left({x}_{N}\right)\right)}{N}$

 • By default, the interval is divided into $10$ equal-sized subintervals.
 • For the options opts, see the ApproximateInt help page.
 • This rule can be applied interactively, through the ApproximateInt Tutor.

Examples

 > $\mathrm{polynomial}≔\mathrm{CurveFitting}[\mathrm{PolynomialInterpolation}]\left(\left[{x}_{0},\frac{2{x}_{0}+{x}_{1}}{3},\frac{{x}_{0}+2{x}_{1}}{3},{x}_{1}\right],\left[f\left(0\right),f\left(\frac{1}{3}\right),f\left(\frac{2}{3}\right),f\left(1\right)\right],z\right):$
 > $\mathrm{integrated}≔{∫}_{{x}_{0}}^{{x}_{1}}\mathrm{polynomial}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}ⅆz:$
 > $\mathrm{factor}\left(\mathrm{integrated}\right)$
 ${-}\frac{{1}}{{8}}{}\left({{x}}_{{0}}{-}{{x}}_{{1}}\right){}\left({f}{}\left({1}\right){+}{3}{}{f}{}\left(\frac{{2}}{{3}}\right){+}{3}{}{f}{}\left(\frac{{1}}{{3}}\right){+}{f}{}\left({0}\right)\right)$ (1)
 > $\mathrm{with}\left(\mathrm{Student}[\mathrm{Calculus1}]\right):$
 > $\mathrm{ApproximateInt}\left(\mathrm{sin}\left(x\right),x=0..5,\mathrm{method}={\mathrm{simpson}}_{\frac{3}{8}}\right)$
 $\frac{{1}}{{8}}{}{\mathrm{sin}}{}\left({4}\right){+}\frac{{3}}{{16}}{}{\mathrm{sin}}{}\left(\frac{{25}}{{6}}\right){+}\frac{{3}}{{16}}{}{\mathrm{sin}}{}\left(\frac{{13}}{{3}}\right){+}\frac{{1}}{{8}}{}{\mathrm{sin}}{}\left(\frac{{9}}{{2}}\right){+}\frac{{3}}{{16}}{}{\mathrm{sin}}{}\left(\frac{{14}}{{3}}\right){+}\frac{{3}}{{16}}{}{\mathrm{sin}}{}\left(\frac{{29}}{{6}}\right){+}\frac{{1}}{{16}}{}{\mathrm{sin}}{}\left({5}\right){+}\frac{{1}}{{8}}{}{\mathrm{sin}}{}\left({3}\right){+}\frac{{3}}{{16}}{}{\mathrm{sin}}{}\left(\frac{{19}}{{6}}\right){+}\frac{{3}}{{16}}{}{\mathrm{sin}}{}\left(\frac{{10}}{{3}}\right){+}\frac{{1}}{{8}}{}{\mathrm{sin}}{}\left(\frac{{7}}{{2}}\right){+}\frac{{3}}{{16}}{}{\mathrm{sin}}{}\left(\frac{{11}}{{3}}\right){+}\frac{{3}}{{16}}{}{\mathrm{sin}}{}\left(\frac{{23}}{{6}}\right){+}\frac{{3}}{{16}}{}{\mathrm{sin}}{}\left(\frac{{11}}{{6}}\right){+}\frac{{1}}{{8}}{}{\mathrm{sin}}{}\left({2}\right){+}\frac{{3}}{{16}}{}{\mathrm{sin}}{}\left(\frac{{13}}{{6}}\right){+}\frac{{3}}{{16}}{}{\mathrm{sin}}{}\left(\frac{{7}}{{3}}\right){+}\frac{{1}}{{8}}{}{\mathrm{sin}}{}\left(\frac{{5}}{{2}}\right){+}\frac{{3}}{{16}}{}{\mathrm{sin}}{}\left(\frac{{8}}{{3}}\right){+}\frac{{3}}{{16}}{}{\mathrm{sin}}{}\left(\frac{{17}}{{6}}\right){+}\frac{{3}}{{16}}{}{\mathrm{sin}}{}\left(\frac{{5}}{{6}}\right){+}\frac{{3}}{{16}}{}{\mathrm{sin}}{}\left(\frac{{7}}{{6}}\right){+}\frac{{3}}{{16}}{}{\mathrm{sin}}{}\left(\frac{{4}}{{3}}\right){+}\frac{{1}}{{8}}{}{\mathrm{sin}}{}\left(\frac{{3}}{{2}}\right){+}\frac{{3}}{{16}}{}{\mathrm{sin}}{}\left(\frac{{5}}{{3}}\right){+}\frac{{3}}{{16}}{}{\mathrm{sin}}{}\left(\frac{{1}}{{3}}\right){+}\frac{{1}}{{8}}{}{\mathrm{sin}}{}\left(\frac{{1}}{{2}}\right){+}\frac{{3}}{{16}}{}{\mathrm{sin}}{}\left(\frac{{2}}{{3}}\right){+}\frac{{3}}{{16}}{}{\mathrm{sin}}{}\left(\frac{{1}}{{6}}\right){+}\frac{{1}}{{8}}{}{\mathrm{sin}}{}\left({1}\right)$ (2)
 > $\mathrm{ApproximateInt}\left(x\left(x-2\right)\left(x-3\right),x=0..5,\mathrm{method}={\mathrm{simpson}}_{\frac{3}{8}},\mathrm{output}=\mathrm{plot}\right)$
 > $\mathrm{ApproximateInt}\left(\mathrm{tan}\left(x\right)-2x,x=-1..1,\mathrm{method}={\mathrm{simpson}}_{\frac{3}{8}},\mathrm{output}=\mathrm{plot},\mathrm{partition}=50\right)$

To play the following animation in this help page, right-click (Control-click, on Macintosh) the plot to display the context menu.  Select Animation > Play.

 > $\mathrm{ApproximateInt}\left(\mathrm{ln}\left(x\right),1..100,\mathrm{method}={\mathrm{simpson}}_{\frac{3}{8}},\mathrm{output}=\mathrm{animation}\right)$

## Was this information helpful?

 Please add your Comment (Optional) E-mail Address (Optional) What is ? This question helps us to combat spam