Math 1070 Matlab Assignment 4 Part 0: Getting started To access the files needed for this assignment, in the class web page http://www.pitt.edu/~trenchea/Math1070_Fall_Semester_2016.html click on A collection of matlab codes accompanying the text and then on Chapter5 Copy the files simpson.m and trapezoidal.m into your working directory. NOTE: type >> format long in matlab at beginning of your work on this assignment. The function function [integral,difference,ratio]=trapezoidal(a,b,n0,index_f) uses the composite trapezoidal rule with n subdivisions to integrate the function f over the interval [a,b]. The values of n used are n = n0,2*n0,4*n0,...,256*n0 Read the comments at the beginning to understand what it is doing. Note that the last parameter index_f allows for different functions to be integrated. The index is given at the end of the file. For example, >> [integral,difference,ratio]=trapezoidal(-1,1,1,4) will integrate exp(cos(x)) on [-1,1] with n = 1,2,4,...,256 subintervals. On output the vector integral stores the corresponding numerical integral, The differences of successive numerical integrals are returned in the vector difference: difference(i) = integral(i)-integral(i-1), i=2,...,9 The entries in ratio give the rate of decrease in these differences. Call the function with various parameters. Do the same with the function simpson in simpson.m No need to submit anything up to this point. Part 1: Submit the results for all you are asked to do. For BOTH TRAPEZOIDAL AND SIMPSON, do the following: 1. Add the function f(x) = sin(x) as case 5 in the index. 2. Run the program to compute the integral of sin(x) on [0,pi/2]. (Note that the exact value is I = 1.) Submit the output vectors integral, difference, and ratio. 3. Use the vector ratio to determine the order of convergence, i.e., the constant "p" in the estimate I - I_n = c/(n^p) Comment if the results confirm the theory. 4. Use Richardson extrapolation and error estimate to obtain an improved integral value and an error estimate for n = 8. 5. For n= 8: Compare the true error with a) the asymptotic error estimate b) the Richardson error estimate 6. For n= 8: Compare the true integral with a) the trapezoidal rule answer I_n b) the Richardson extrapolation value ONLY FOR TRAPEZOIDAL: 7. Repeat steps 2. and 3. for the integral of sin(x) on [0,2*pi]. (Note that the exact value is I = 0.) Explain the accelerated rate of convergence. Part 2: Submit the results for all you are asked to do. DO THE FOLLOWING ONLY FOR THE TRAPEZOIDAL RULE. 8. Write a new function corrected_trapezoidal that implements the corrected trapezoidal rule. To do this just copy trapezoidal.m into corrected_trapezoidal.m and modify the latter file. Submit your code in corrected_trapezoidal.m. 9. Run corrected_trapezoidal to compute the integral of sin(x) on [0,pi/2]. Submit the output vectors integral, difference, and ratio. 10. Use the vector ratio to determine the order of convergence, i.e., the constant "p" in the estimate I - I_n = c/(n^p) 11. Compare your estimate with the estimate for the trapezoidal rule from 3.