Skip to main content

CLP-2 Integral Calculus

Section 1.11 Numerical Integration

By now the reader will have come to appreciate that integration is generally quite a bit more difficult than differentiation. There are a great many simple-looking integrals, such as ∫eβˆ’x2dx, that are either very difficult or even impossible to express in terms of standard functions
 1 
We apologise for being a little sloppy here β€” but we just want to say that it can be very hard or even impossible to write some integrals as some finite sized expression involving polynomials, exponentials, logarithms and trigonometric functions. We don’t want to get into a discussion of computability, though that is a very interesting topic.
. Such integrals are not merely mathematical curiosities, but arise very naturally in many contexts. For example, the error function
erf(x)=2Ο€βˆ«0xeβˆ’t2dt
is extremely important in many areas of mathematics, and also in many practical applications of statistics.
In such applications we need to be able to evaluate this integral (and many others) at a given numerical value of x. In this section we turn to the problem of how to find (approximate) numerical values for integrals, without having to evaluate them algebraically. To develop these methods we return to Riemann sums and our geometric interpretation of the definite integral as the signed area.
We start by describing (and applying) three simple algorithms for generating, numerically, approximate values for the definite integral ∫abf(x)dx. In each algorithm, we begin in much the same way as we approached Riemann sums.
  • We first select an integer n>0, called the β€œnumber of steps”.
  • We then divide the interval of integration, a≀x≀b, into n equal subintervals, each of length Ξ”x=bβˆ’an. The first subinterval runs from x0=a to x1=a+Ξ”x. The second runs from x1 to x2=a+2Ξ”x, and so on. The last runs from xnβˆ’1=bβˆ’Ξ”x to xn=b.
This splits the original integral into n pieces:
∫abf(x)dx=∫x0x1f(x)dx+∫x1x2f(x)dx+β‹―+∫xnβˆ’1xnf(x)dx
Each subintegral ∫xjβˆ’1xjf(x)dx is approximated by the area of a simple geometric figure. The three algorithms we consider approximate the area by rectangles, trapezoids and parabolas (respectively).
We will explain these rules in detail below, but we give a brief overview here:
  1. The midpoint rule approximates each subintegral by the area of a rectangle of height given by the value of the function at the midpoint of the subinterval
    ∫xjβˆ’1xjf(x)dxβ‰ˆf(xjβˆ’1+xj2)Ξ”x
    This is illustrated in the leftmost figure above.
  2. The trapezoidal rule approximates each subintegral by the area of a trapezoid with vertices at (xjβˆ’1,0),(xjβˆ’1,f(xjβˆ’1)),(xj,f(xj)),(xj,0):
    ∫xjβˆ’1xjf(x)dxβ‰ˆ12[f(xjβˆ’1)+f(xj)]Ξ”x
    The trapezoid is illustrated in the middle figure above. We shall derive the formula for the area shortly.
  3. Simpson’s rule approximates two adjacent subintegrals by the area under a parabola that passes through the points (xjβˆ’1,f(xjβˆ’1)), (xj,f(xj)) and (xj+1,f(xj+1)):
    ∫xjβˆ’1xj+1f(x)dxβ‰ˆ13[f(xjβˆ’1)+4f(xj)+f(xj+1)]Ξ”x
    The parabola is illustrated in the right hand figure above. We shall derive the formula for the area shortly.

Definition 1.11.1. Midpoints.

In what follows we need to refer to the midpoint between xjβˆ’1 and xj very frequently. To save on writing (and typing) we introduce the notation
xΒ―j=12(xjβˆ’1+xj).

Subsection 1.11.1 The midpoint rule

The integral ∫xjβˆ’1xjf(x)dx represents the area between the curve y=f(x) and the x-axis with x running from xjβˆ’1 to xj. The width of this region is xjβˆ’xjβˆ’1=Ξ”x. The height varies over the different values that f(x) takes as x runs from xjβˆ’1 to xj.
The midpoint rule approximates this area by the area of a rectangle of width xjβˆ’xjβˆ’1=Ξ”x and height f(xΒ―j) which is the exact height at the midpoint of the range covered by x.
The area of the approximating rectangle is f(xΒ―j)Ξ”x, and the midpoint rule approximates each subintegral by
∫xjβˆ’1xjf(x)dxβ‰ˆf(xΒ―j)Ξ”x.
Applying this approximation to each subinterval and summing gives us the following approximation of the full integral:
∫abf(x)dx=∫x0x1f(x)dx+∫x1x2f(x)dx+β‹―+∫xnβˆ’1xnf(x)dxβ‰ˆf(xΒ―1)Ξ”x+f(xΒ―2)Ξ”x+β‹―+f(xΒ―n)Ξ”x
So notice that the approximation is the sum of the function evaluated at the midpoint of each interval and then multiplied by Ξ”x. Our other approximations will have similar forms.
In summary:

Example 1.11.3. ∫0141+x2dx.

We approximate the above integral using the midpoint rule with n=8 step.
Solution:
  • First we set up all the x-values that we will need. Note that a=0, b=1, Ξ”x=18 and
    x0=0x1=18x2=28β‹―x7=78x8=88=1
    Consequently
    xΒ―1=116xΒ―2=316xΒ―3=516β‹―xΒ―8=1516
  • We now apply Equation 1.11.2 to the integrand f(x)=41+x2:
    ∫0141+x2dxβ‰ˆ[41+xΒ―12⏞f(xΒ―1)+41+xΒ―22⏞f(xΒ―2)+β‹―+41+xΒ―72⏞f(xΒ―nβˆ’1)+41+xΒ―82⏞f(xΒ―n)]Ξ”x=[41+1162+41+32162+41+52162+41+72162+41+92162+41+112162+41+132162+41+152162]18=[3.98444+3.86415+3.64413+3.35738+3.03858+2.71618+2.40941+2.12890]18=3.1429
    where we have rounded to four decimal places.
  • In this case we can compute the integral exactly (which is one of the reasons it was chosen as a first example):
    ∫0141+x2dx=4arctan⁑x|01=Ο€
  • So the error in the approximation generated by eight steps of the midpoint rule is
    |3.1429βˆ’Ο€|=0.0013
  • The relative error is then
    |approximateβˆ’exact|exact=|3.1429βˆ’Ο€|Ο€=0.0004
    That is the error is 0.0004 times the actual value of the integral.
  • We can write this as a percentage error by multiplying it by 100
    percentage error=100Γ—|approximateβˆ’exact|exact=0.04%
    That is, the error is about 0.04% of the exact value.
The midpoint rule gives us quite good estimates of the integral without too much work β€” though it is perhaps a little tedious to do by hand
 2 
Thankfully it is very easy to write a program to apply the midpoint rule.
. Of course, it would be very helpful to quantify what we mean by β€œgood” in this context and that requires us to discuss errors.

Definition 1.11.4.

Suppose that Ξ± is an approximation to A. This approximation has
  • absolute error |Aβˆ’Ξ±| and
  • relative error |Aβˆ’Ξ±||A| and
  • percentage error 100|Aβˆ’Ξ±||A|
We will discuss errors further in Section 1.11.4 below.

Example 1.11.5. ∫0Ο€sin⁑xdx.

As a second example, we apply the midpoint rule with n=8 steps to the above integral.
  • We again start by setting up all the x-values that we will need. So a=0, b=Ο€, Ξ”x=Ο€8 and
    x0=0x1=Ο€8x2=2Ο€8β‹―x7=7Ο€8x8=8Ο€8=Ο€
    Consequently,
    xΒ―1=Ο€16xΒ―2=3Ο€16β‹―xΒ―7=13Ο€16xΒ―8=15Ο€16
  • Now apply Equation 1.11.2 to the integrand f(x)=sin⁑x:
    ∫0Ο€sin⁑xdxβ‰ˆ[sin⁑(xΒ―1)+sin⁑(xΒ―2)+β‹―+sin⁑(xΒ―8)]Ξ”x=[sin⁑(Ο€16)+sin⁑(3Ο€16)+sin⁑(5Ο€16)+sin⁑(7Ο€16)+sin⁑(9Ο€16)+sin⁑(11Ο€16)+sin⁑(13Ο€16)+sin⁑(15Ο€16)]Ο€8=[0.1951+0.5556+0.8315+0.9808+0.9808+0.8315+0.5556+0.1951]Γ—0.3927=5.1260Γ—0.3927=2.013
  • Again, we have chosen this example so that we can compare it against the exact value:
    ∫0Ο€sin⁑xdx=[βˆ’cos⁑x]0Ο€=βˆ’cos⁑π+cos⁑0=2.
  • So with eight steps of the midpoint rule we achieved
    absolute error=|2.013βˆ’2|=0.013relative error=|2.013βˆ’2|2=0.0065percentage error=100Γ—|2.013βˆ’2|2=0.65%
    With little work we have managed to estimate the integral to within 1% of its true value.

Subsection 1.11.2 The trapezoidal rule

Consider again the area represented by the integral ∫xjβˆ’1xjf(x)dx. The trapezoidal rule
 3 
This method is also called the β€œtrapezoid rule” and β€œtrapezium rule”.
(unsurprisingly) approximates this area by a trapezoid
 4 
A trapezoid is a four sided polygon, like a rectangle. But, unlike a rectangle, the top and bottom of a trapezoid need not be parallel.
whose vertices lie at
(xjβˆ’1,0),(xjβˆ’1,f(xjβˆ’1)),(xj,f(xj)) and (xj,0).
The trapezoidal approximation of the integral ∫xjβˆ’1xjf(x)dx is the shaded region in the figure on the right above. It has width xjβˆ’xjβˆ’1=Ξ”x. Its left hand side has height f(xjβˆ’1) and its right hand side has height f(xj).
As the figure below shows, the area of a trapezoid is its width times its average height.
So the trapezoidal rule approximates each subintegral by
∫xjβˆ’1xjf(x)dxβ‰ˆf(xjβˆ’1)+f(xj)2Ξ”x
Applying this approximation to each subinterval and then summing the result gives us the following approximation of the full integral
∫abf(x)dx=∫x0x1f(x)dx+∫x1x2f(x)dx+β‹―+∫xnβˆ’1xnf(x)dxβ‰ˆf(x0)+f(x1)2Ξ”x+f(x1)+f(x2)2Ξ”x+β‹―+f(xnβˆ’1)+f(xn)2Ξ”x=[12f(x0)+f(x1)+f(x2)+β‹―+f(xnβˆ’1)+12f(xn)]Ξ”x
So notice that the approximation has a very similar form to the midpoint rule, excepting that
  • we evaluate the function at the xj’s rather than at the midpoints, and
  • we multiply the value of the function at the endpoints x0,xn by 12.
In summary:
To compare and contrast we apply the trapezoidal rule to the examples we did above with the midpoint rule.

Example 1.11.7. ∫0141+x2dx β€” using the trapezoidal rule.

Solution: We proceed very similarly to Example 1.11.3 and again use n=8 steps.
  • We again have f(x)=41+x2, a=0, b=1, Ξ”x=18 and
    x0=0x1=18x2=28β‹―x7=78x8=88=1
  • Applying the trapezoidal rule, Equation 1.11.6, gives
    ∫0141+x2dxβ‰ˆ[1241+x02⏞f(x0)+41+x12⏞f(x1)+β‹―+41+x72⏞f(xnβˆ’1)+1241+x82⏞f(xn)]Ξ”x=[1241+02+41+182+41+2282+41+3282+41+4282+41+5282+41+6282+41+7282+1241+8282]18=[12Γ—4+3.939+3.765+3.507+3.2+2.876+2.56+2.266+12Γ—2]18=3.139
    to three decimal places.
  • The exact value of the integral is still Ο€. So the error in the approximation generated by eight steps of the trapezoidal rule is |3.139βˆ’Ο€|=0.0026, which is 100|3.139βˆ’Ο€|Ο€%=0.08% of the exact answer. Notice that this is roughly twice the error that we achieved using the midpoint rule in Example 1.11.3.
Let us also redo Example 1.11.5 using the trapezoidal rule.

Example 1.11.8. ∫0Ο€sin⁑xdx β€” using the trapezoidal rule.

Solution: We proceed very similarly to Example 1.11.5 and again use n=8 steps.
  • We again have a=0, b=Ο€, Ξ”x=Ο€8 and
    x0=0x1=Ο€8x2=2Ο€8β‹―x7=7Ο€8x8=8Ο€8=Ο€
  • Applying the trapezoidal rule, Equation 1.11.6, gives
    ∫0Ο€sin⁑xdxβ‰ˆ[12sin⁑(x0)+sin⁑(x1)+β‹―+sin⁑(x7)+12sin⁑(x8)]Ξ”x=[12sin⁑0+sin⁑π8+sin⁑2Ο€8+sin⁑3Ο€8+sin⁑4Ο€8+sin⁑5Ο€8+sin⁑6Ο€8+sin⁑7Ο€8+12sin⁑8Ο€8]Ο€8=[12Γ—0+0.3827+0.7071+0.9239+1.0000+0.9239+0.7071+0.3827+12Γ—0]Γ—0.3927=5.0274Γ—0.3927=1.974
  • The exact answer is ∫0Ο€sin⁑xdx=βˆ’cos⁑x|0Ο€=2. So with eight steps of the trapezoidal rule we achieved 100|1.974βˆ’2|2=1.3% accuracy. Again this is approximately twice the error we achieved in Example 1.11.5 using the midpoint rule.
These two examples suggest that the midpoint rule is more accurate than the trapezoidal rule. Indeed, this observation is born out by a rigorous analysis of the error β€” see Section 1.11.4.

Subsection 1.11.3 Simpson’s Rule

When we use the trapezoidal rule we approximate the area ∫xjβˆ’1xjf(x)dx by the area between the x-axis and a straight line that runs from (xjβˆ’1,f(xjβˆ’1)) to (xj,f(xj)) β€” that is, we approximate the function f(x) on this interval by a linear function that agrees with the function at each endpoint. An obvious way to extend this β€” just as we did when extending linear approximations to quadratic approximations in our differential calculus course β€” is to approximate the function with a quadratic. This is precisely what Simpson’s
 5 
Simpson’s rule is named after the 18th century English mathematician Thomas Simpson, despite its use a century earlier by the German mathematician and astronomer Johannes Kepler. In many German texts the rule is often called Kepler’s rule.
rule does.
Simpson’s rule approximates the integral over two neighbouring subintervals by the area between a parabola and the x-axis. In order to describe this parabola we need 3 distinct points (which is why we approximate two subintegrals at a time). That is, we approximate
∫x0x1f(x)dx+∫x1x2f(x)dx=∫x0x2f(x)dx
by the area bounded by the parabola that passes through the three points (x0,f(x0)), (x1,f(x1)) and (x2,f(x2)), the x-axis and the vertical lines x=x0 and x=x2.
We repeat this on the next pair of subintervals and approximate ∫x2x4f(x)dx by the area between the x-axis and the part of a parabola with x2≀x≀x4. This parabola passes through the three points (x2,f(x2)), (x3,f(x3)) and (x4,f(x4)). And so on. Because Simpson’s rule does the approximation two slices at a time, n must be even.
To derive Simpson’s rule formula, we first find the equation of the parabola that passes through the three points (x0,f(x0)), (x1,f(x1)) and (x2,f(x2)). Then we find the area between the x-axis and the part of that parabola with x0≀x≀x2. To simplify this computation consider a parabola passing through the points (βˆ’h,yβˆ’1),(0,y0) and (h,y1).
Write the equation of the parabola as
y=Ax2+Bx+C
Then the area between it and the x-axis with x running from βˆ’h to h is
βˆ«βˆ’hh[Ax2+Bx+C]dx=[A3x3+B2x2+Cx]βˆ’hh=2A3h3+2Chit is helpful to write it as=h3(2Ah2+6C)
Now, the three points (βˆ’h,yβˆ’1),(0,y0) and (h,y1) lie on this parabola if and only if
Ah2βˆ’Bh+C=yβˆ’1at (βˆ’h,yβˆ’1)C=y0at (0,y0)Ah2+Bh+C=y1at (h,y1)
Adding the first and third equations together gives us
2Ah2+(Bβˆ’B)h+2C=yβˆ’1+y1
To this we add four times the middle equation
2Ah2+6C=yβˆ’1+4y0+y1.
This means that
area=βˆ«βˆ’hh[Ax2+Bx+C]dx=h3(2Ah2+6C)=h3(yβˆ’1+4y0+y1)
Note that here
  • h is one half of the length of the x-interval under consideration
  • yβˆ’1 is the height of the parabola at the left hand end of the interval under consideration
  • y0 is the height of the parabola at the middle point of the interval under consideration
  • y1 is the height of the parabola at the right hand end of the interval under consideration
So Simpson’s rule approximates
∫x0x2f(x)dxβ‰ˆ13Ξ”x[f(x0)+4f(x1)+f(x2)]
∫x2x4f(x)dxβ‰ˆ13Ξ”x[f(x2)+4f(x3)+f(x4)]
and so on. Summing these all together gives:
∫abf(x)dx=∫x0x2f(x)dx+∫x2x4f(x)dx+∫x4x6f(x)dx+β‹―+∫xnβˆ’2xnf(x)dxβ‰ˆΞ”x3[f(x0)+4f(x1)+f(x2)]+Ξ”x3[f(x2)+4f(x3)+f(x4)]   +Ξ”x3[f(x4)+4f(x5)+f(x6)]+β‹― +Ξ”x3[f(xnβˆ’2)+4f(xnβˆ’1)+f(xn)]=[f(x0)+4f(x1)+2f(x2)+4f(x3)+2f(x4)+β‹―+2f(xnβˆ’2)+4f(xnβˆ’1)+f(xn)]Ξ”x3
In summary
Notice that Simpson’s rule requires essentially no more work than the trapezoidal rule. In both rules we must evaluate f(x) at x=x0,x1,β‹―,xn, but we add those terms multiplied by different constants
 6 
There is an easy generalisation of Simpson’s rule that uses cubics instead of parabolas. It is known as Simpson’s second rule and Simpson’s 38 rule. While one can push this approach further (using quartics, quintics etc), it can sometimes lead to larger errors β€” the interested reader should look up Runge’s phenomenon.
.
Let’s put it to work on our two running examples.

Example 1.11.10. ∫0141+x2dx β€” using Simpson’s rule.

Solution: We proceed almost identically to Example 1.11.7 and again use n=8 steps.
  • We have the same Ξ”,a,b,x0,β‹―,xn as Example 1.11.7.
  • Applying Equation 1.11.9 gives
    ∫0141+x2dxβ‰ˆ[41+02+441+182+241+2282+441+3282+241+4282+441+5282+241+6282+441+7282+41+8282]18Γ—3=[4+4Γ—3.938461538+2Γ—3.764705882+4Γ—3.506849315+2Γ—3.2+4Γ—2.876404494+2Γ—2.56+4Γ—2.265486726+2]18Γ—3=3.14159250
    to eight decimal places.
  • This agrees with Ο€ (the exact value of the integral) to six decimal places. So the error in the approximation generated by eight steps of Simpson’s rule is |3.14159250βˆ’Ο€|=1.5Γ—10βˆ’7, which is 100|3.14159250βˆ’Ο€|Ο€%=5Γ—10βˆ’6% of the exact answer.
It is striking that the absolute error approximating with Simpson’s rule is so much smaller than the error from the midpoint and trapezoidal rules.
midpoint error=0.0013trapezoid error=0.0026Simpson error=0.00000015
Buoyed by this success, we will also redo Example 1.11.8 using Simpson’s rule.

Example 1.11.11. ∫0Ο€sin⁑xdx β€” Simpson’s rule.

Solution: We proceed almost identically to Example 1.11.8 and again use n=8 steps.
  • We have the same Ξ”,a,b,x0,β‹―,xn as Example 1.11.7.
  • Applying Equation 1.11.9 gives
    ∫0Ο€sin⁑xdxβ‰ˆ[sin⁑(x0)+4sin⁑(x1)+2sin⁑(x2)+β‹―+4sin⁑(x7)+sin⁑(x8)]Ξ”x3=[sin⁑(0)+4sin⁑(Ο€8)+2sin⁑(2Ο€8)+4sin⁑(3Ο€8)+2sin⁑(4Ο€8)=[sin⁑(0)+4sin⁑(5Ο€8)+2sin⁑(6Ο€8)+4sin⁑(7Ο€8)+sin⁑(8Ο€8)]Ο€8Γ—3=[0+4Γ—0.382683+2Γ—0.707107+4Γ—0.923880+2Γ—1.0=[0+4Γ—0.923880+2Γ—0.707107+4Γ—0.382683+0]Ο€8Γ—3=15.280932Γ—0.130900=2.00027
  • With only eight steps of Simpson’s rule we achieved 1002.00027βˆ’22=0.014% accuracy.
Again we contrast the error we achieved with the other two rules:
midpoint error=0.013trapezoid error=0.026Simpson error=0.00027
This completes our derivation of the midpoint, trapezoidal and Simpson’s rules for approximating the values of definite integrals. So far we have not attempted to see how efficient and how accurate the algorithms are in general. That’s our next task.

Subsection 1.11.4 Three Simple Numerical Integrators β€” Error Behaviour

Now we are armed with our three (relatively simple) methods for numerical integration we should give thought to how practical they might be in the real world
 7 
Indeed, even beyond the β€œreal world” of many applications in first year calculus texts, some of the methods we have described are used by actual people (such as ship builders, engineers and surveyors) to estimate areas and volumes of actual objects!
. Two obvious considerations when deciding whether or not a given algorithm is of any practical value are
  1. the amount of computational effort required to execute the algorithm and
  2. the accuracy that this computational effort yields.
For algorithms like our simple integrators, the bulk of the computational effort usually goes into evaluating the function f(x). The number of evaluations of f(x) required for n steps of the midpoint rule is n, while the number required for n steps of the trapezoidal and Simpson’s rules is n+1. So all three of our rules require essentially the same amount of effort β€” one evaluation of f(x) per step.
To get a first impression of the error behaviour of these methods, we apply them to a problem whose answer we know exactly:
∫0Ο€sin⁑xdx=βˆ’cos⁑x|0Ο€=2.
To be a little more precise, we would like to understand how the errors of the three methods change as we increase the effort we put in (as measured by the number of steps n). The following table lists the error in the approximate value for this number generated by our three rules applied with three different choices of n. It also lists the number of evaluations of f required to compute the approximation.
Midpoint Trapezoidal Simpson’s
n error # evals error # evals error # evals
10 8.2Γ—10βˆ’3 10 1.6Γ—10βˆ’2 11 1.1Γ—10βˆ’4 11
100 8.2Γ—10βˆ’5 100 1.6Γ—10βˆ’4 101 1.1Γ—10βˆ’8 101
1000 8.2Γ—10βˆ’7 1000 1.6Γ—10βˆ’6 1001 1.1Γ—10βˆ’12 1001
Observe that
  • Using 101 evaluations of f worth of Simpson’s rule gives an error 75 times smaller than 1000 evaluations of f worth of the midpoint rule.
  • The trapezoidal rule error with n steps is about twice the midpoint rule error with n steps.
  • With the midpoint rule, increasing the number of steps by a factor of 10 appears to reduce the error by about a factor of 100=102=n2.
  • With the trapezoidal rule, increasing the number of steps by a factor of 10 appears to reduce the error by about a factor of 102=n2.
  • With Simpson’s rule, increasing the number of steps by a factor of 10 appears to reduce the error by about a factor of 104=n4.
So it looks like
approx value of βˆ«abf(x)dx given by n midpoint steps β‰ˆβˆ«abf(x)dx+KMβ‹…1n2approx value of βˆ«abf(x)dx given by n trapezoidal steps β‰ˆβˆ«abf(x)dx+KTβ‹…1n2approx value of βˆ«abf(x)dx given by n Simpson's steps β‰ˆβˆ«abf(x)dx+KSβ‹…1n4
with some constants KM, KT and KS. It also seems that KTβ‰ˆ2KM.
Figure 1.11.12. A log-log plot of the error in the n step approximation to ∫0Ο€sin⁑xdx.
To test these conjectures for the behaviour of the errors we apply our three rules with about ten different choices of n of the form n=2m with m integer. Figure 1.11.12 contains two graphs of the results. The left-hand plot shows the results for the midpoint and trapezoidal rules and the right-hand plot shows the results for Simpson’s rule.
For each rule we are expecting (based on our conjectures above) that the error
en=|exact value βˆ’ approximate value|
with n steps is (roughly) of the form
en=K1nk
for some constants K and k. We would like to test if this is really the case, by graphing Y=en against X=n and seeing if the graph β€œlooks right”. But it is not easy to tell whether or not a given curve really is Y=KXk, for some specific k, by just looking at it. However, your eye is pretty good at determining whether or not a graph is a straight line. Fortunately, there is a little trick that turns the curve Y=KXk into a straight line β€” no matter what k is.
Instead of plotting Y against X, we plot log⁑Y against log⁑X. This transformation
 8 
There is a variant of this trick that works even when you don’t know the answer to the integral ahead of time. Suppose that you suspect that the approximation satisfies Mn=A+K1nk where A is the exact value of the integral and suppose that you don’t know the values of A, K and k. Then Mnβˆ’M2n=K1nkβˆ’K1(2n)k=K(1βˆ’12k)1nk so plotting y=log⁑(Mnβˆ’M2n) against x=log⁑n gives the straight line y=log⁑[K(1βˆ’12k)]βˆ’kx.
works because when Y=KXk
log⁑Y=log⁑Kβˆ’klog⁑X
So plotting y=log⁑Y against x=log⁑X gives the straight line y=log⁑Kβˆ’kx, which has slope βˆ’k and y-intercept log⁑K.
The three graphs in Figure 1.11.12 plot y=log2⁑en against x=log2⁑n for our three rules. Note that we have chosen to use logarithms
 9 
Now is a good time for a quick revision of logarithms β€” see β€œWhirlwind review of logarithms” in Section 2.7 of the CLP-1 text.
with this β€œunusual base” because it makes it very clear how much the error is improved if we double the number of steps used. To be more precise β€” one unit step along the x-axis represents changing n↦2n. For example, applying Simpson’s rule with n=24 steps results in an error of 0.0000166, so the point (x=log2⁑24=4,y=log2⁑0.0000166=log⁑0.0000166log⁑2=βˆ’15.9) has been included on the graph. Doubling the effort used β€” that is, doubling the number of steps to n=25β€” results in an error of 0.00000103. So, the data point (x=log2⁑25=5 , y=log2⁑0.00000103=ln⁑0.00000103ln⁑2=βˆ’19.9) lies on the graph. Note that the x-coordinates of these points differ by 1 unit.
For each of the three sets of data points, a straight line has also been plotted β€œthrough” the data points. A procedure called linear regression
 10 
Linear regression is not part of this course as its derivation requires some multivariable calculus. It is a very standard technique in statistics.
has been used to decide precisely which straight line to plot. It provides a formula for the slope and y-intercept of the straight line which β€œbest fits” any given set of data points. From the three lines, it sure looks like k=2 for the midpoint and trapezoidal rules and k=4 for Simpson’s rule. It also looks like the ratio between the value of K for the trapezoidal rule, namely K=20.7253, and the value of K for the midpoint rule, namely K=2βˆ’0.2706, is pretty close to 2: 20.7253/2βˆ’0.2706=20.9959.
The intuition, about the error behaviour, that we have just developed is in fact correct β€” provided the integrand f(x) is reasonably smooth. To be more precise
The first of these error bounds in proven in the following (optional) section. Here are some examples which illustrate how they are used. First let us check that the above result is consistent with our data in Figure 1.11.12

Example 1.11.14. Midpoint rule error approximating ∫0Ο€sin⁑xdx.

  • The integral ∫0Ο€sin⁑xdx has bβˆ’a=Ο€.
  • The second derivative of the integrand satisfies
    |d2dx2sin⁑x|=|βˆ’sin⁑x|≀1
    So we take M=1.
  • So the error, en, introduced when n steps are used is bounded by
    |en|≀M24(bβˆ’a)3n2=Ο€3241n2β‰ˆ1.291n2
  • The data in the graph in Figure 1.11.12 gives
    |en|β‰ˆ2βˆ’.27061n2=0.831n2
    which is consistent with the bound |en|≀π3241n2.
In a typical application we would be asked to evaluate a given integral to some specified accuracy. For example, if you are manufacturer and your machinery can only cut materials to an accuracy of 110th of a millimeter, there is no point in making design specifications more accurate than 110th of a millimeter.

Example 1.11.15. How many steps for a given accuracy?

Suppose, for example, that we wish to use the midpoint rule to evaluate
 11 
This is our favourite running example of an integral that cannot be evaluated algebraically β€” we need to use numerical methods.
∫01eβˆ’x2dx
to within an accuracy of 10βˆ’6.
Solution:
  • The integral has a=0 and b=1.
  • The first two derivatives of the integrand are
    ddxeβˆ’x2=βˆ’2xeβˆ’x2andd2dx2eβˆ’x2=ddx(βˆ’2xeβˆ’x2)=βˆ’2eβˆ’x2+4x2eβˆ’x2=2(2x2βˆ’1)eβˆ’x2
  • As x runs from 0 to 1, 2x2βˆ’1 increases from βˆ’1 to 1, so that
    0≀x≀1⟹|2x2βˆ’1|≀1, eβˆ’x2≀1⟹|2(2x2βˆ’1)eβˆ’x2|≀2
    So we take M=2.
  • The error introduced by the n step midpoint rule is at most
    en≀M24(bβˆ’a)3n2≀224(1βˆ’0)3n2=112n2
  • We need this error to be smaller than 10βˆ’6 so
    en≀112n2≀10βˆ’6and so 12n2β‰₯106clean upn2β‰₯10612=83333.3square root both sidesnβ‰₯288.7
    So 289 steps of the midpoint rule will do the job.
  • In fact n=289 results in an error of about 3.7Γ—10βˆ’7.
That seems like far too much work, and the trapezoidal rule will have twice the error. So we should look at Simpson’s rule.

Example 1.11.16. How many steps using Simpson’s rule?

Suppose now that we wish evaluate ∫01eβˆ’x2dx to within an accuracy of 10βˆ’6 β€” but now using Simpson’s rule. How many steps should we use?
Solution:
  • Again we have a=0,b=1.
  • We then need to bound d4dx4eβˆ’x2 on the domain of integration, 0≀x≀1.
    d3dx3eβˆ’x2=ddx{2(2x2βˆ’1)eβˆ’x2}=8xeβˆ’x2βˆ’4x(2x2βˆ’1)eβˆ’x2=4(βˆ’2x3+3x)eβˆ’x2d4dx4eβˆ’x2=ddx{4(βˆ’2x3+3x)eβˆ’x2}=4(βˆ’6x2+3)eβˆ’x2βˆ’8x(βˆ’2x3+3x)eβˆ’x2=4(4x4βˆ’12x2+3)eβˆ’x2
  • Now, for any x, eβˆ’x2≀1. Also, for 0≀x≀1,
    0≀x2,x4≀1 so3≀4x4+3≀7 and βˆ’12β‰€βˆ’12x2≀0adding these together givesβˆ’9≀4x4βˆ’12x2+3≀7
    Consequently, |4x4βˆ’12x2+3| is bounded by 9 and so
    |d4dx4eβˆ’x2|≀4Γ—9=36
    So take L=36.
  • The error introduced by the n step Simpson’s rule is at most
    en≀L180(bβˆ’a)5n4≀36180(1βˆ’0)5n4=15n4
  • In order for this error to be no more than 10βˆ’6 we require n to satisfy
    en≀15n4≀10βˆ’6and so5n4β‰₯106n4β‰₯200000take fourth rootnβ‰₯21.15
    So 22 steps of Simpson’s rule will do the job.
  • n=22 steps actually results in an error of 3.5Γ—10βˆ’8. The reason that we get an error so much smaller than we need is that we have overestimated the number of steps required. This, in turn, occurred because we made quite a rough bound of |d4dx4f(x)|≀36. If we are more careful then we will get a slightly smaller n. It actually turns out
     12 
    The authors tested this empirically.
    that you only need n=10 to approximate within 10βˆ’6.

Subsection 1.11.5 Optional β€” An error bound for the midpoint rule

We now try develop some understanding as to why we got the above experimental results. We start with the error generated by a single step of the midpoint rule. That is, the error introduced by the approximation
∫x0x1f(x)dxβ‰ˆf(xΒ―1)Ξ”x where Ξ”x=x1βˆ’x0, xΒ―1=x0+x12
To do this we are going to need to apply integration by parts in a sneaky way. Let us start by considering
 13 
We chose this interval so that we didn’t have lots of subscripts floating around in the algebra.
a subinterval α≀x≀β and let’s call the width of the subinterval 2q so that Ξ²=Ξ±+2q. If we were to now apply the midpoint rule to this subinterval, then we would write
∫αβf(x)dxβ‰ˆ2qβ‹…f(Ξ±+q)=qf(Ξ±+q)+qf(Ξ²βˆ’q)
since the interval has width 2q and the midpoint is Ξ±+q=Ξ²βˆ’q.
The sneaky trick we will employ is to write
∫αβf(x)dx=∫αα+qf(x)dx+βˆ«Ξ²βˆ’qΞ²f(x)dx
and then examine each of the integrals on the right-hand side (using integration by parts) and show that they are each of the form
∫αα+qf(x)dxβ‰ˆqf(Ξ±+q)+small error termβˆ«Ξ²βˆ’qΞ²f(x)dxβ‰ˆqf(Ξ²βˆ’q)+small error term
Let us apply integration by parts to ∫αα+qf(x)dx β€” with u=f(x),dv=dx so du=fβ€²(x)dx and we will make the slightly non-standard choice of v=xβˆ’Ξ±:
∫αα+qf(x)dx=[(xβˆ’Ξ±)f(x)]Ξ±Ξ±+qβˆ’βˆ«Ξ±Ξ±+q(xβˆ’Ξ±)fβ€²(x)dx=qf(Ξ±+q)βˆ’βˆ«Ξ±Ξ±+q(xβˆ’Ξ±)fβ€²(x)dx
Notice that the first term on the right-hand side is the term we need, and that our non-standard choice of v allowed us to avoid introducing an f(Ξ±) term.
Now integrate by parts again using u=fβ€²(x),dv=(xβˆ’Ξ±)dx, so du=fβ€³(x),v=(xβˆ’Ξ±)22:
∫αα+qf(x)dx=qf(Ξ±+q)βˆ’βˆ«Ξ±Ξ±+q(xβˆ’Ξ±)fβ€²(x)dx=qf(Ξ±+q)βˆ’[(xβˆ’Ξ±)22fβ€²(x)]Ξ±Ξ±+q+∫αα+q(xβˆ’Ξ±)22fβ€³(x)dx=qf(Ξ±+q)βˆ’q22fβ€²(Ξ±+q)+∫αα+q(xβˆ’Ξ±)22fβ€³(x)dx
To obtain a similar expression for the other integral, we repeat the above steps and obtain:
βˆ«Ξ²βˆ’qΞ²f(x)dx=qf(Ξ²βˆ’q)+q22fβ€²(Ξ²βˆ’q)+βˆ«Ξ²βˆ’qΞ²(xβˆ’Ξ²)22fβ€³(x)dx
Now add together these two expressions
∫αα+qf(x)dx+βˆ«Ξ²βˆ’qΞ²f(x)dx=qf(Ξ±+q)+qf(Ξ²βˆ’q)+q22(fβ€²(Ξ²βˆ’q)βˆ’fβ€²(Ξ±+q))+∫αα+q(xβˆ’Ξ±)22fβ€³(x)dx+βˆ«Ξ²βˆ’qΞ²(xβˆ’Ξ²)22fβ€³(x)dx

Then since Ξ±+q=Ξ²βˆ’q we can combine the integrals on the left-hand side and eliminate some terms from the right-hand side:

∫αβf(x)dx=2qf(Ξ±+q)+∫αα+q(xβˆ’Ξ±)22fβ€³(x)dx+βˆ«Ξ²βˆ’qΞ²(xβˆ’Ξ²)22fβ€³(x)dx
Rearrange this expression a little and take absolute values
|∫αβf(x)dxβˆ’2qf(Ξ±+q)|≀|∫αα+q(xβˆ’Ξ±)22fβ€³(x)dx|+|βˆ«Ξ²βˆ’qΞ²(xβˆ’Ξ²)22fβ€³(x)dx|
where we have also made use of the triangle inequality
 14 
The triangle inequality says that for any real numbers x,y |x+y|≀|x|+|y|.
. By assumption |fβ€³(x)|≀M on the interval α≀x≀β, so
|∫αβf(x)dxβˆ’2qf(Ξ±+q)|≀M∫αα+q(xβˆ’Ξ±)22dx+Mβˆ«Ξ²βˆ’qΞ²(xβˆ’Ξ²)22dx=Mq33=M(Ξ²βˆ’Ξ±)324
where we have used q=Ξ²βˆ’Ξ±2 in the last step.
Thus on any interval xi≀x≀xi+1=xi+Ξ”x
|∫xixi+1f(x)dxβˆ’Ξ”xf(xi+xi+12)|≀M24(Ξ”x)3
Putting everything together we see that the error using the midpoint rule is bounded by
|∫abf(x)dxβˆ’[f(xΒ―1)+f(xΒ―2)+β‹―+f(xΒ―n)]Ξ”x|≀|∫x0x1f(x)dxβˆ’Ξ”xf(xΒ―1)|+β‹―+|∫xnβˆ’1xnf(x)dxβˆ’Ξ”xf(xΒ―n)|≀nΓ—M24(Ξ”x)3=nΓ—M24(bβˆ’an)3=M(bβˆ’a)324n2
as required.
A very similar analysis shows that, as was stated in Theorem 1.11.13 above,
  • the total error introduced by the trapezoidal rule is bounded by M12(bβˆ’a)3n2,
  • the total error introduced by Simpson’s rule is bounded by M180(bβˆ’a)5n4

Exercises 1.11.6 Exercises

Recall that we are using log⁑x to denote the logarithm of x with base e. In other courses it is often denoted ln⁑x.

Exercises β€” Stage 1 .

1.
Suppose we approximate an object to have volume 1.5m3, when its exact volume is 1.387m3. Give the relative error, absolute error, and percent error of our approximation.
2.
Consider approximating ∫210f(x)dx, where f(x) is the function in the graph below.
  1. Draw the rectangles associated with the midpoint rule approximation and n=4.
  2. Draw the trapezoids associated with the trapezoidal rule approximation and n=4.
You don’t have to give an approximation.
3.
Let f(x)=βˆ’112x4+76x3βˆ’3x2.
  1. Find a reasonable value M such that |fβ€³(x)|≀M for all 1≀x≀6.
  2. Find a reasonable value L such that |f(4)(x)|≀L for all 1≀x≀6.
4.
Let f(x)=xsin⁑x+2cos⁑x. Find a reasonable value M such that |fβ€³(x)|≀M for all βˆ’3≀x≀2.
5.
Consider the quantity A=βˆ«βˆ’Ο€Ο€cos⁑xdx.
  1. Find the upper bound on the error using Simpson’s rule with n=4 to approximate A using Theorem 1.11.13 in the text.
  2. Find the Simpson’s rule approximation of A using n=4.
  3. What is the (actual) absolute error in the Simpson’s rule approximation of A with n=4?
6.
Give a function f(x) such that:
  • fβ€³(x)≀3 for every x in [0,1], and
  • the error using the trapezoidal rule approximating ∫01f(x)dx with n=2 intervals is exactly 116.
7.
Suppose my mother is under 100 years old, and I am under 200 years old.
 15 
We’re going somewhere with this.
Who is older?
8.
  1. True or False: for fixed positive constants M, n, a, and b, with b>a,
    M24(bβˆ’a)3n2≀M12(bβˆ’a)3n2
  2. True or False: for a function f(x) and fixed constants n, a, and b, with b>a, the n-interval midpoint approximation of ∫abf(x)dx is more accurate than the n-interval trapezoidal approximation.
9. (✳).
Decide whether the following statement is true or false. If false, provide a counterexample. If true, provide a brief justification.
When f(x) is positive and concave up, any trapezoidal rule approximation for ∫abf(x)dx will be an upper estimate for ∫abf(x)dx.
10.
Give a polynomial f(x) with the property that the Simpson’s rule approximation of ∫abf(x)dx is exact for all a, b, and n.

Exercises β€” Stage 2 .

Questions 11 and 12 ask you to approximate a given integral using the formulas in Equations 1.11.2, 1.11.6, and 1.11.9 in the text.
Questions 13 though 17 ask you to approximate a quantity based on observed data.
In Questions 18 through 24, we practice finding error bounds for our approximations.
11.
Write out all three approximations of ∫0301x3+1dx with n=6. (That is: midpoint, trapezoidal, and Simpson’s.) You do not need to simplify your answers.
12. (✳).
Find the midpoint rule approximation to ∫0Ο€sin⁑xdx with n=3.
13. (✳).
The solid V is 40 cm high and the horizontal cross sections are circular disks. The table below gives the diameters of the cross sections in centimeters at 10 cm intervals. Use the trapezoidal rule to estimate the volume of V.
height 0 10 20 30 40
diameter 24 16 10 6 4
14. (✳).
A 6 metre long cedar log has cross sections that are approximately circular. The diameters of the log, measured at one metre intervals, are given below:
metres from left end of log 0 1 2 3 4 5 6
diameter in metres 1.2 1 0.8 0.8 1 1 1.2
Use Simpson’s Rule to estimate the volume of the log.
15. (✳).
The circumference of an 8 metre high tree at different heights above the ground is given in the table below. Assume that all horizontal cross-sections of the tree are circular disks.
height (metres) 0 2 4 6 8
circumference (metres) 1.2 1.1 1.3 0.9 0.2
Use Simpson’s rule to approximate the volume of the tree.
16. (✳).
By measuring the areas enclosed by contours on a topographic map, a geologist determines the cross sectional areas A in m2 of a 60 m high hill. The table below gives the cross sectional area A(h) at various heights h. The volume of the hill is V=∫060A(h)dh.
h 0 10 20 30 40 50 60
A 10,200 9,200 8,000 7,100 4,500 2,400 100
  1. If the geologist uses the Trapezoidal Rule to estimate the volume of the hill, what will be their estimate, to the nearest 1,000m3?
  2. What will be the geologist’s estimate of the volume of the hill if they use Simpson’s Rule instead of the Trapezoidal Rule?
17. (✳).
The graph below applies to both parts (a) and (b).
  1. Use the Trapezoidal Rule, with n=4, to estimate the area under the graph between x=2 and x=6. Simplify your answer completely.
  2. Use Simpson’s Rule, with n=4, to estimate the area under the graph between x=2 and x=6.
18. (✳).
The integral βˆ«βˆ’11sin⁑(x2)dx is estimated using the Midpoint Rule with 1000 intervals. Show that the absolute error in this approximation is at most 2β‹…10βˆ’6.
You may use the fact that when approximating ∫abf(x)dx with the Midpoint Rule using n points, the absolute value of the error is at most M(bβˆ’a)3/24n2 when |fβ€³(x)|≀M for all x∈[a,b].
19. (✳).
The total error using the midpoint rule with n subintervals to approximate the integral of f(x) over [a,b] is bounded by M(bβˆ’a)3(24n2), if |fβ€³(x)|≀M for all a≀x≀b.
Using this bound, if the integral βˆ«βˆ’212x4dx is approximated using the midpoint rule with 60 subintervals, what is the largest possible error between the approximation M60 and the true value of the integral?
20. (✳).
Both parts of this question concern the integral I=∫02(xβˆ’3)5dx.
  1. Write down the Simpson’s Rule approximation to I with n=6. Leave your answer in calculator-ready form.
  2. Which method of approximating I results in a smaller error bound: the Midpoint Rule with n=100 intervals, or Simpson’s Rule with n=10 intervals? You may use the formulas
    |EM|≀M(bβˆ’a)324n2and|ES|≀L(bβˆ’a)5180n4,
    where M is an upper bound for |fβ€³(x)| and L is an upper bound for |f(4)(x)|, and EM and ES are the absolute errors arising from the midpoint rule and Simpson’s rule, respectively.
21. (✳).
Find a bound for the error in approximating ∫151xdx using Simpson’s rule with n=4. Do not write down the Simpson’s rule approximation S4.
In general the error in approximating ∫abf(x)dx using Simpson’s rule with n steps is bounded by L(bβˆ’a)180(Ξ”x)4 where Ξ”x=bβˆ’an and Lβ‰₯|f(4)(x)| for all a≀x≀b.
22. (✳).
Find a bound for the error in approximating
∫01(eβˆ’2x+3x3)dx
using Simpson’s rule with n=6. Do not write down the Simpson’s rule approximation Sn.
In general, the error in approximating ∫abf(x)dx using Simpson’s rule with n steps is bounded by L(bβˆ’a)180(Ξ”x)4 where Ξ”x=bβˆ’an and Lβ‰₯|f(4)(x)| for all a≀x≀b.
23. (✳).
Let I=∫12(1/x)dx.
  1. Write down the trapezoidal approximation T4 for I. You do not need to simplify your answer.
  2. Write down the Simpson’s approximation S4 for I. You do not need to simplify your answer.
  3. Without computing I, find an upper bound for |Iβˆ’S4|. You may use the fact that if |f(4)(x)|≀L on the interval [a,b], then the error in using Sn to approximate ∫abf(x)dx has absolute value less than or equal to L(bβˆ’a)5/180n4.
24. (✳).
A function s(x) satisfies s(0)=1.00664, s(2)=1.00543, s(4)=1.00435, s(6)=1.00331, s(8)=1.00233. Also, it is known to satisfy |s(k)(x)|≀k1000 for 0≀x≀8 and all positive integers k.
  1. Find the best Trapezoidal Rule and Simpson’s Rule approximations that you can for I=∫08s(x)dx.
  2. Determine the maximum possible sizes of errors in the approximations you gave in part (a). Recall that if a function f(x) satisfies |f(k)(x)|≀Kk on [a,b], then
    |∫abf(x)dxβˆ’Tn|≀K2(bβˆ’a)312n2and|∫abf(x)dxβˆ’Sn|≀K4(bβˆ’a)5180n4
25. (✳).
Consider the trapezoidal rule for making numerical approximations to ∫abf(x)dx. The error for the trapezoidal rule satisfies |ET|≀M(bβˆ’a)312n2 , where |fβ€³(x)|≀M for a≀x≀b. If βˆ’2<fβ€³(x)<0 for 1≀x≀4, find a value of n to guarantee the trapezoidal rule will give an approximation for ∫14f(x)dx with absolute error, |ET|, less than 0.001.

Exercises β€” Stage 3 .

26. (✳).
A swimming pool has the shape shown in the figure below. The vertical cross-sections of the pool are semi-circular disks. The distances in feet across the pool are given in the figure at 2--foot intervals along the sixteen--foot length of the pool. Use Simpson’s Rule to estimate the volume of the pool.
27. (✳).
A piece of wire 1m long with radius 1mm is made in such a way that the density varies in its cross-section, but is radially symmetric (that is, the local density g(r) in kg/m3 depends only on the distance r in mm from the centre of the wire). Take as given that the total mass W of the wire in kg is given by
W=2Ο€10βˆ’6∫01rg(r)dr
Data from the manufacturer is given below:
r 0 1/4 1/2 3/4 1
g(r) 8051 8100 8144 8170 8190
  1. Find the best Trapezoidal Rule approximation that you can for W based on the data in the table.
  2. Suppose that it is known that |gβ€²(r)|<200 and |gβ€³(r)|<150 for all values of r. Determine the maximum possible size of the error in the approximation you gave in part (a). Recall that if a function f(x) satisfies |fβ€³(x)|≀M on [a,b], then
    |Iβˆ’Tn|≀M(bβˆ’a)312n2
    where I=∫abf(x)dx and Tn is the Trapezoidal Rule approximation to I using n subintervals.
28. (✳).
Simpson’s rule can be used to approximate log⁑2, since log⁑2=∫121xdx.
  1. Use Simpson’s rule with 6 subintervals to approximate log⁑2.
  2. How many subintervals are required in order to guarantee that the absolute error is less than 0.00001?
    Note that if En is the error using n subintervals, then |En|≀L(bβˆ’a)5180n4 where L is the maximum absolute value of the fourth derivative of the function being integrated and a and b are the end points of the interval.
29. (✳).
Let I=∫02cos⁑(x2)dx and let Sn be the Simpson’s rule approximation to I using n subintervals.
  1. Estimate the maximum absolute error in using S8 to approximate I.
  2. How large should n be in order to ensure that |Iβˆ’Sn|≀0.0001?
Note: The graph of f⁗(x), where f(x)=cos⁑(x2), is shown below. The absolute error in the Simpson’s rule approximation is bounded by L(bβˆ’a)5180n4 when |f⁗(x)|≀L on the interval [a,b].
30. (✳).
Define a function f(x) and an integral I by
f(x)=∫0x2sin⁑(t)dt,I=∫01f(t)dt
Estimate how many subdivisions are needed to calculate I to five decimal places of accuracy using the trapezoidal rule.
Note that if En is the error using n subintervals, then |En|≀M(bβˆ’a)312n212, where M is the maximum absolute value of the second derivative of the function being integrated and a and b are the limits of integration.
31.
Let f(x) be a function
 18 
For example, f(x)=16x3βˆ’12x2+(1+x)log⁑|x+1| will do, but you don’t need to know what f(x) is for this problem.
with fβ€³(x)=x2x+1.
  1. Show that |fβ€³(x)|≀1 whenever x is in the interval [0,1].
  2. Find the maximum value of |fβ€³(x)| over the interval [0,1].
  3. Assuming M=1, how many intervals should you use to approximate ∫01f(x)dx to within 10βˆ’5?
  4. Using the value of M you found in (b), how many intervals should you use to approximate ∫01f(x)dx to within 10βˆ’5?
32.
Approximate the function log⁑x with a rational function by approximating the integral ∫1x121tdt using Simpson’s rule. Your rational function f(x) should approximate log⁑x with an error of not more than 0.1 for any x in the interval [1,3].
33.
Using an approximation of the area under the curve 1x2+1, show that the constant arctan⁑2 is in the interval [Ο€4+0.321,Ο€4+0.323].
You may assume use without proof that d4dx4{11+x2}=24(5x4βˆ’10x2+1)(x2+1)5. You may use a calculator, but only to add, subtract, multiply, and divide.