# CS 3200: Introduction to Scientific Computing Assignment 2 solved

\$40.00

## Description

5/5 - (1 vote)

During lecture we discussed a number of integral quadrature methods. Each method calculates a
set of weight/position pairs {π€π€ππ, π₯π₯ππ}, for integrating a curve.
οΏ½ ππ(π₯π₯)ππππ β οΏ½π€π€ππππ(π₯π₯ππ)
ππ
ππ=1
ππ
ππ
1. Implement the following Newton-Cotes methods for finding {π€π€ππ, π₯π₯ππ} pairs
a. Constant interpolant (composite midpoint rule) for ππ = 17,33,65,129,257,513
b. Linear interpolant (composite trapezoid rule) for ππ = 17,33,65,129,257,513
c. Quadratic interpolant (composite Simpson formula) for ππ = 17,33,65,129,257,513
2. Implement the following Gaussian methods given by the following {π₯π₯ππ, π€π€ππ} pairs.
Note: the points are defined on [-1,1] and have to be mapped onto [a,b].
π΅π΅ ππππ ππππ
1 0 2
2 Β±1/β3 1
3
0 8/9
Β±οΏ½3/5 5/9
4
Β±οΏ½(3 β 2οΏ½6/5)/7 (18 + β30)/36
Β±οΏ½(3 + 2οΏ½6/5)/7 (18 β β30)/36
5
0 128/225
Β±
1
3
οΏ½5 β 2οΏ½10/7 (322 + 13β70)/900
Β±
1
3
οΏ½5 + 2οΏ½10/7 (322 β 13β70)/900
3. Calculate the integral for the function below using all of the methods above.
2
οΏ½ 1 + sin(π₯π₯) β cos οΏ½
2π₯π₯
3 οΏ½ β sin(4π₯π₯) ππππ
2ππ
0
β’ Report the results and create a convergence plot for the 3 Newton-Cotes formulas (a) (b)
and (c) above for ππ = 217,33,65,129,257,513 that shows how quickly the methods go to a
common final value.
o Which of the Newton-Cotes formulas converges fastest? Is that in line with the theoretical
error? Why?
o
β’ Estimate the error for the Trapezoidal Rule and Simpsonβs Rule by estimating the appropriate
derivatives and using the explicit from of the error. Now estimate the errors by using
Richardson Extrapolation . Which error estimates are more accurate?
β’ Report the results for ππ = 2, 3, 4, 5 for the Gaussian quadratures given above
o The Gaussian quadratures are high-order functions, yet they donβt do a good job
approximating the integral, why?
o What could be done to make the Gaussian quadratures give better results?
What to turn in
For these assignments, we expect both SOURCE CODE and a written REPORT be uploaded as a zip
or tarball file to Canvas.
β’ Source code for all programs that you write, thoroughly documented.
o Include a README file describing how to compile and run your code.
β’ Your report should be in PDF format and should stand on its own.
o It should describe the methods used.
o It should explain your results and contain figures.