Solution for Problem 4
First, the students should recognize that since we only know the function values at the end points of each sub-interval, in order to apply the midpoint, we can only use half of our data and 5 sub-intervals rather than 10.
Input :=
Clear[y, i]
Input :=
dx = 1;
n = 10;
y[i_] = height[i];
Input :=
TrapRule10 =
N[(dx/2) (y[0] + 2 Sum[y[i], {i, 1, n-1}] + y[n])]
Output =
57.8963
Input :=
SimpRule10 =
N[(dx/3)
(4 Sum[y[2 i - 1], {i, 1, n/2}] +
2 Sum[y[2 i], {i, 1, n/2 - 1}])]
Output =
58.2522