$25
Submit all of your documented Matlab code. Additional written work and discussion of problems should be a single pdf that is well-organized and either typed or neatly written. Matlab output should be discussed in the write-up.
Quadrature Rules
Determine constants a, b, c, d, and e that will produce a quadrature formula as follows that has degree of precision 4. (i.e. exact for a polynomial of degree 4 with arbitrary coefficients)
Composite Integration
Here, let’s define n as the number of intervals. Note that the number of nodes will depend on whether you are using Trapezoid Rule (integrals with upper and lower bounds xj+1 and xj) and Simpson’s Rule (integrals with upper and lower bounds xj+2 and xj). In terms of defining the appropriate h, be careful as to whether you are using number of nodes or number of intervals.
Create function files for composite trapezoid and composite Simpson’s rules. The mainfile should be able to call these functions that have an input including the function along with the upper bound b, lower bound a and either n or h.
Approximate the following integrals:
√ √
Note that the exact value for the first integral is (5/2) 26 − (1/2)ln(−5 + 26) and the exact value for the second is 2π.
(4 points) Create Tables similar to those below describe error and convergence. Discuss the behavior of the error with regards to varying the total number of intervals n or number of points NTot (or as h decreases by a factor of 2).
Ntot
Trap
Simp
NTot
(trap error)/h2
(Simp error)/h4
1