- To get full credit, you must write down sufficient intermediate steps, only giving the final answer earns you no credit!
- Please make sure that your handwriting is recognizable, otherwise you only get partial credit for the recognizable part.
- Simpsons rule.
- Show that on [1,1] Simpsons rule can be obtained as follows
,
where y C4[1,1] and p3(y;1,0,0,1;t) is the interpolation polynomial of y with interpolation conditions p3(1) = y(1), p3(0) = y(0),
(0), and p3(1) = y(1).
- Derive ES(y).
- Using (a), (b) and a change of variable, derivethe composite Simpsons rule and prove the theorem on its error estimation.
- Estimate the number of subintervals required to ap-proximateto 6 correct decimal places, i.e. the absolute error is no greater than 0.5 106,
- by the composite trapezoidal rule,(b) by the composite Simpsons rule.
- Gauss-Laguerre quadrature formula.
- Construct a polynomial 2(t) = t2 + at + b that is orthogonal to P1 with respect to the weight function (t) = et, i.e.
p P1, .
(hint:
- (10 points) Derive the two-point Gauss-Laguerrequadrature formula
and express E2(f) in terms of f(4)() for some > 0.
x | 0.0 | 0.5 | 1.0 | 1.5 | 2.0 | 2.5 | 3.0 |
y | 2.9 | 2.7 | 4.8 | 5.3 | 7.1 | 7.6 | 7.7 |
x | 3.5 | 4.0 | 4.5 | 5.0 | 5.5 | 6.0 | 6.5 |
y | 7.6 | 9.4 | 9.0 | 9.6 | 10.0 | 10.2 | 9.7 |
x | 7.0 | 7.5 | 8.0 | 8.5 | 9.0 | 9.5 | 10.0 |
y | 8.3 | 8.4 | 9.0 | 8.3 | 6.6 | 6.7 | 4.1 |
- Apply the formula in (b) to approximate
Use the remainder to estimate the error and compare your estimate with the true error. With the true error, identify the unknown quantity contained in E2(f).
(hint: use the exact value I = 0.596347361)
The above four problems weigh 15, 10, and 20 points, respectively.
2 C++ programming
Write a C++ function to perform discrete least square via QR factorization. Your algorithm should take as input the maximum degree of the fitting polynomial, three or more data pairs (xi,yi), and output coefficients of the fitted polynomial.
Run your subroutine on the following data.
In the notes, the condition number of a matrix A is defined as condA (x) = kAkkA1k.
Report the condition number based on the 2-norm of the matrix G in the normal-equation approach (reuse results of your previous homework!) and that of the matrix R1 in the QR-factorization approach, verifying that the former is much larger than the latter.
This programming assignment weighs 10 points. Thus the total number of points is 55 for this homework.
Reviews
There are no reviews yet.