Using Taylor/Maclaurin Series to Approximate Integrals:
We can use a Taylor Series expansion to approximate the value of an integral. Consider the integral given by:
Suppose we wish to approximate this integral to within 0.001. We first find the Maclaurin (Taylor Series centered at a = 0) Series for
.If we examine the first 5 terms an obvious pattern emerges;:
| > | restart:with(plots):
for i from 1 to 5 do print(convert(taylor(exp(x),x=0,i),polynom)): end do: r:=Sum('x^k/k!',k=0..infinity); |
Warning, the name changecoords has been redefined
| > |
We conclude that:
If we substitute we obtain the following integral:
We can now integrate term by term to obtain:
Since this is an alternating series, we can use the Alternating Series Estimation Theorem given below to determine the number of terms needed to satisfy our accuracy tolerance.
We want to find n such that .
| > | restart:with(plots):
for i from 0 to 6 do a[i]:=1/((2.*i+1)*i!): end do: MATRIX([[n=0,n=1,n=2,n=3,n=4,n=5],[a[0],a[1],a[2],a[3],a[4],a[5]]]); |
Warning, the name changecoords has been redefined
| > |
We can see that the tolerance is satisfied with n = 5. The approximate value of the integral is:
We can let MAPLE compute the integral internally. Run the code below by pressing "Enter".
| > | Int(exp(-x^2),x=0..1)=int(exp(-x^2),x=0..1.); |
Notice that the difference between our estimate and the MAPLE estimate is within tolerance.
| > |