MA/CSC 427 Project #3 Due: November 7, 2021
Part I. (25 pts total) Generate the Gaussian abscissas and weights.
1. (5 pts, 1 pt each) Families of orthogonal polynomials can be found in various sources, e.g., the
library orthopoly in Maple. List the first five Legendre polynomials, Pk(x), k = 1, . . . , 5, over the
interval [−1, 1].
2. (10 pts, 2 pts each) Use existing library routines, e.g., routines in Maple or Matlab to find out all
roots for each of these polynomials. Use a table to display these roots up to the 16th significant
digits for each of the Legendre polynomials. (These roots are the abscissas in the corresponding
Gaussian quadrature.)
3. (10 pts, 2 pts each) Recall that the weight is obtained from
ωi =
∫ 1
−1
`i(t) dt
where `i(x) is simply the Lagrange basis polynomial
`i(t) =
n∏
j=1,j 6=i
t− xj
xi − xj .
Use the Gaussian abscissas found in (b) to calculate the corresponding Gaussian weights ωi up
to 16th significant digits. (Note: This integration of `i(t) ought to be done by hard analysis. To
alleviate the burden, you may use any numerical integrator to obtain these αi. In doing so, keep in
mind that you are developing a numerical integrator by another numerical integrator, i.e., you are
chasing the tails. You are allowed to do so in this project only for your convenience.)
Part II. (40 pts total) Build the following two codes:
1. (20 pts) Based on the 5-point Gaussian quadrature, implement a general-purpose code in the form
Q = my_single_integral(FUN,A,B)
that returns an approximation of the definite integral of a scalar-valued function FUN(t) defined
over the interval [A,B]. Your code must be able to take in any continuous single variable function
FUN .
2. (20 pts) Use the 1-D integrator you have built above, implement a general-purpose code for the
double integral ∫ b
a
∫ h(x)
g(x)
f(x, y) dy dx.
Your code should be in the form
W = my_double_integral(FUN,A,B,G,H)
where FUN(x, y) is defined over the planar region {(x, y)|A ≤ x ≤ B,G(x) ≤ y ≤ H(x)}. FUN is
to be specified by the user, G and H may each be a scalar or a function.
Part III. (25 pts total) Apply you code my_double_integral to evaluate the following double integral:∫ pi/4
0
∫ sin x
0
2y sinx+ (cosx)2√
1− y2 dy dx.
1. (5 pts) Integrate the integral as it is. Display your results up to 16 digits. Since we do not know
the true answer, it remains to determine how correct the numerical answer is.
2. (20 pts) Divide the interval [0, pi4 ] to 10 evenly spaced subintervals. For each nodal point of x, divide
also the corresponding interval [0, sinx] in the y direction to 10 evenly spaced subintervals. In this
way, you have 100 subregions to work with. To write everything out will be a fairly complicated
composite double quadrature rule. Write a code to repeatedly using my_double_integral to finish
the integration. Display your results up to 16 digits. How correct is the answer?
Part IV. (30 pts total) In practice, other than the Simpson’s rule or the Gaussian quadrature, the Clenshaw-Curtis
quadrature is another popular integrator. The default numerical method used in Maple
evalf(int(f, x = a..b))
or its equivalence in Matlab, for example, prefers to use this quadrature in place of the Gaussian quadra-
ture. Such a scheme has less degree of precision than the Gaussian quadrature since the later is optimal,
but why is it popular? Conduct a literature research into this method.
1. (20 pts) Write a report on your reading of this Clenshaw-Curtis quadrature. Describe what this
Clenshaw-Curtis quadrature is about and how it works. (This is an exercise on reading the literature
for research purpose.)
2. (5 pts) Elaborate on why this method is preferred in practice.
3. (5 pts) Compare your numerical answer for Part III.2 above with that obtained from Maple or your
calculator calculation. How do you know whose answer is more accurate? Give the reason.
Instruction for Your Report
• Be aware that this project has a total of 120 points. The extra 20 points should be used to make up
whatever you have lost in the first two projects.
• All results need be typed up and submitted in the .pdf format. Name your document as
MA427_Project3_YourLastName(s).
You have to use this file name, or it will be rejected.
• Email your report to mtchu@ncsu.edu with your file name as the subject line by 6:00 PM, Sunday,
November 7, 2021.
• While you are answering the above questions, your report should contain four sections:
– Introduction. This is the place where you introduce why integration is so important that you have
to learn it in MA241, MA242, repeat it in MA427, and perhaps in many other places..
– Mathematical issues. This is where you review or explain the mathematical theory that is involved
in this project. Recall that we have spent a considerable amount of time on deriving the Gaussian
quadrature.
– Programming issues. Describe any programming tactics or design details you have employed in
your code. Remember to attach your codes here.
– Conclusion. Analyze your observations and draw conclusions of your experiments here. Be bold to
carry out investigations by yourselves.
Your report should read like a complete research paper. It need not be long, but should be written in
such a way with valuable points. I will pay attention to how you organize your paper this time.
学霸联盟