How do you Use the trapezoidal rule with #n=8# to approximate the integral #int_0^pix^2*sin(x)dx#?

1 Answer
Aug 9, 2014

The "trap rule" approximates the area by creating n trapezoids with their bases on the x-axis, top corners along the curve y = f(x), and then adding their areas together.

Here we evaluate the function f(x) = x^2 sin(x) at 9 points along the interval from 0 to π, to make 8 intervals of #Delta#x = π/8 for the trapezoid bases. x = 0, π/8, π/4, . . . , 7π/8, and π, then plug all these into the function f(x), to get the heights of the sides of the trapezoids: f(0) = 0^2 sin(0) = 0, f(π/8) = (π/8)^2 sin(π/8), etc.

Now use the trapezoid area formula: #A_(trap) = b*(h_1+h_2)/(2)#
In our case #DeltaA = Deltax*(f(x_(i-1))+f(x_i))/(2)#
and when you add all n of these together you get

#sum_(i=1)^n DeltaA = Deltax*{f(x_0)+2f(x_1)+…+2f(x_(n-1))+f(x_n)}#

because the middle terms appear twice, the right side of one trapezoid being the left side of the next. For our example,

#A = sum_(i=1)^8= π/8[f(0)+2*f(π/8)+…+2*f((7π)/8)+f(π)]#.

You get to evaluate each term to as much accuracy as you need to get your answer to the specified tolerance. Happy calculator plugging!

\another fine answer from dansmath/