integrate Taylor series function?

I am writing a algorithm to test how fast the area under a function can be found. My function is e^(-x^2). when i integrate the function from -3 to 3 i get about 1.77241. Next i tried to compute the area of the function again, but i converted the function to the first 5 non zero terms in the taylor series. I got: 1-x^2+x^4/2-x^6/6+x^8/24+O(x^9) where O(x^9) is the error. when i integrate 1-x^2+x^4/2-x^6/6+x^8/2 from -3 to 3 i get 2119.46 which is not even close to the real integral. how do i compute the area under the taylor series version of the function to get a similar answer to 1.77. Shouldnt the regular function and the taylor series function be equal (except for the error term), which would make the integrals equal???

J2010-10-23T10:32:25Z

Favorite Answer

First, the Taylor series should have x^8 / 24 at the end, not x^8 / 2 as you show. Second when you integrate the corrected Taylor series from -3 to 3 you get 114.707 which is still not close to 1.77241. The problem lies in the error term. You have pretty good fit between -2 and 2 but the error is huge as you get further away from 0. You have to take MANY more terms.

JOS J2010-10-23T17:16:45Z

In need to expand the Taylor Series to 50 terms to get the correct approximation

which is

1.77104