Use series to approximate the definite integral to within th
Use series to approximate the definite integral to within the indicated accuracy:
Solution
similar example
integral from 0 to 0.4
 e^(-x^2),dx, with an error < 10^-4
Since e^t = (n=0 to ) t^n / n!,
 letting t = -x^2 yields
 e^(-x^2) = (n=0 to ) (-1)^n * x^(2n) / n!.
 
 Integrate both sides from 0 to 0.4:
 (0 to 0.4) e^(-x^2) dx = (n=0 to ) (-1)^n * (0.4)^(2n+1) / ((2n+1) * n!).
 
 Since this is an alternating series, we may estimate the error after n terms with
 the magnitude of the (n+1)-th term.
 
 ==> |error| <= |(-1)^(n+1) * (0.4)^(2n+3) / ((2n+3) * (n+1)!)| < 10^(-4)
 ==> (2/5)^(2n+3) / ((2n+3) * (n+1)!) < 1/10^4
 ==> (5/2)^(2n+3) * (2n+3) * (n+1)! > 10^4.
 
 By trial and error, the first integer value of n that works is n = 2.
 
 Thus,
 (0 to 0.4) e^(-x^2) dx
  (n=0 to 2) (-1)^n * (0.4)^(2n+1) / ((2n+1) * n!).
 = 0.4 - (0.4)^3 / (3 * 1!) + (0.4)^5 / (5 * 2!).
  0.3797

