Midpoint Rule, Trapezoid Rule and relative error

Find the Midpoint and Trapezoid Rule approximations to sin πx dx using n = 25 subintervals. Compute the relative error of each approximation.

The actual value of

Step 1</p>

We have to approximate using both midpoint rule and trapezoidal rule by taking n=25.

And then we have to compute the relative error for both the approximations.

Step 2</p>

Mid point rule:

The general midpoint rule is

Where the interval is and and are the midpoints for each interval.

Thus for the given question we get

And the subintervals will be

Therefore we have

………..

Therefore

The relative error in this case is given by the equation