Solution for Problem 6
Input :=
Clear[y, i]
Input :=
dx = 0.5;
n = 20;
y[i_] = height[i/2];
Input :=
TrapRule20 =
N[(dx/2) (y[0] + 2 Sum[y[i], {i, 1, n-1}] + y[n])]
Output =
58.2025
Input :=
SimpRule20 =
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.3046
Here's another shot to see if higher n can improve the estimates more.
Input :=
Clear[y, i]
Input :=
dx = 0.25;
n = 40;
y[i_] = height[i/4];
Input :=
TrapRule40 =
N[(dx/2) (y[0] + 2 Sum[y[i], {i, 1, n-1}] + y[n])]
Output =
58.293
Input :=
SimpRule40 =
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.3232