> format short e; > format compact; First we calculate the area and error for 8, 16, and 32 intervals using the usual Simpsons rule. > [h,area,e1] = simp(2,3,8+1); > [h,area,e2] = simp(2,3,16+1); > [h,area,e3] = simp(2,3,32+1); Here are the errors > e1 e1 = 1.0438e-006 > e2 e2 = 6.5150e-008 > e3 e3 = 4.0704e-009 The ratios of the errors are like 16, consistent with an error that is like h^4 > e1/e2 ans = 1.6022e+001 > e2/e3 ans = 1.6006e+001 First we calculate the area and error for 8, 16, and 32 intervals using the corrected Simpsons rule. > [h,area,e1] = corr_simp(2,3,8+1); > [h,area,e2] = corr_simp(2,3,16+1); > [h,area,e3] = corr_simp(2,3,32+1); Now the errors are smaller > e1 e1 = -1.9413e-009 > e2 e2 = -3.0295e-011 > e3 e3 = -4.7318e-013 And the ratios are like 64, consistent with an error like h^6 > e1/e2 ans = 6.4079e+001 > e2/e3 ans = 6.4024e+001 Finally, we calculate the area and error for 8, 16, and 32 intervals using the Richardson extrapolation on Simpsons rule. > [h,area,e3] = richardson_simp(2,3,32+1); > [h,area,e2] = richardson_simp(2,3,16+1); > [h,area,e1] = richardson_simp(2,3,8+1); Again, the errors are smaller than regular Simpsons rule. > e1 e1 = -9.7103e-011 > e2 e2 = -1.5150e-012 > e3 e3 = -2.4092e-014 And the ratios are like 64, consistent with an error like h^6 > e1/e2 ans = 6.4094e+001 > e2/e3 ans = 6.2885e+001 > diary off