Comparing the Midpoint and Trapezoid Rules Compare the errors in the Midpoint and Trapezoid Rules with n =4, 8, 16, and 32 subintervals when they are applied to the following integrals (with their exact values given).

Solution:-Step1Given thatCompare the errors in the Midpoint and Trapezoid Rules with n =4, 8, 16, and 32 subintervalsn = 4,8, 16, and 32The exact values of the integrals are given for computing the error. -Step2To find Compare the errors in the Midpoint and Trapezoid Rules with n =4, 8, 16, and 32 subintervals when they are applied to the following integrals (with their exact values given).Step3 a=0 , b=1, n=4Using midpoint ruleStep4Midpoint sum for N=4++-------+)++-------+)=0.219239Error for N=4 for midpoint rule===0.00298308Step5Using midpoint ruleMidpoint sum for N=8++-------+)++-------+)=0.222026Error for N=8 for midpoint rule===0.000195816Step6Using midpoint ruleMidpoint sum for N=16++-------+)++-------+)=0.222210Error for N=16 for midpoint rule===0.0000121536Step7Using midpoint ruleMidpoint sum for N=32++-------+)++-------+)=0.222221Error for N=32 for midpoint rule===5.42622Step8N=4Using trapezoidal ruleTrapezoidal sum for N=4=0.225655Error for N=4 for trapezoidal rule===0.00343267Step9N=8Using trapezoidal ruleTrapezoidal sum for N=8=0.222447Error for N=8 for trapezoidal rule===0.000224793Step10N=16Using trapezoidal ruleTrapezoidal sum for N=16=0.222236Error for N=16 for trapezoidal rule===0.000144888Step11N=32Using trapezoidal ruleTrapezoidal sum for N=32=0.222223Error for N=32 for trapezoidal rule===0.00000116756Step 12Table for approximation and errorNApproximation (Midpoint Rule)Error(Midpoint Rule)Approximation (Trapezoidal Rule)Error(Trapezoidal Rule)40.2192390.002983080.2256550.0034326780.2220260.0001958160.2224470.000224793160.2222100.00001215360.2222360.0000144888320.2222215.426220.2222230.00000116756