SOME PROBLEMS FOR THE FINAL EXAM PREPARATION FINAL FALL, 2001, INSTRUCTOR: LUDMIL ZIKATANOV Problem: a) Find a polynomial q3 (x) such that q3 (2) = 1 and Z 2 q3 (x)xk dx = 0 for k = 0, 1, 2 −2 R2 R1 R2 (Hint: −2 x dx = −2 x3 dx = −2 x5 dx = 0). Also watch out the interval is not [−1, 1], but this is very similar to what we have done in class. Solution: We know that q3 (x) should have the form q3 (x) = ax3 + bx2 + cx + d. We use the hint, the equations: Z 2 q3 (x)xk dx = 0 for k = 0, 1, 2 −2 and also q3 (2) = 1 to find a, b and c and d. 16 k=0 4d + b = 0. 3 64 16 d + b = 0. k=2 3 5 16 64 a + c = 0. k=1 5 3 q3 (2) = 1 8a + 4b + 2c + d = 1. 5 , c = − 43 . Finally First two equations give b = d = 0 and third and forth a = 16 x (5x2 − 12 q3 (x) = 16 b) Given a function f on [−1, 1]. Let p2 (x) be the Lagrange interpolation polynomial using the zeros of the polynomial q3 as above. We have the following Gaussian Quadrature Rule: Z 2 Z 2 10 f f (x) dx ≈ p2 (x) dx = 9 −2 −2 Verify that A0 = r r 10 3 3 −2 + A1 f 0 + f 2 . 5 9 5 16 9 . Solution: Since when f (x) = 1 the formulae has to be exact we get that A1 + 20 9 = 4, i.e. . A1 = 16 9 Another solution is obtained via the definition. R1 c) Using the above Gaussian quadrature rule to approximately evaluate −1 x6 dx (with a proper change of variable) 1 2 FINAL FALL, 2001, INSTRUCTOR: LUDMIL ZIKATANOV Z 1 Z 1 2 t Solution: Change the variables t = 2x and get x6 dx = f ( ) dt ≈ 2 2 −1 −2 r !6 r !6 5 6 8 5 27 3 3 5 − = . + ·0+ =2 9 5 9 9 5 9 125 25 Problem: Find the formula with which to replace ??? below so that the resulting function s(x) is a natural cubic spline on the interval [−3, 1] with knots at −3, −2, −1, 0, and 1. x ∈ [−3, −2], 1 − 2x + 9x2 + x3 , 9 + 10x + 15x2 + 2x3 , x ∈ [−2, −1], s(x) = x ∈ [−1, 0], 6 + x + 6x2 − x3 , ???, x ∈ [0, 1]. Solution: We can write the question marks as 1 − 2x + 9x2 + x3 , 9 + 10x + 15x2 + 2x3 , s(x) = 6 + x + 6x2 − x3 , ax3 + bx2 + cx + d, a third degree polynomial x ∈ [−3, −2], x ∈ [−2, −1], x ∈ [−1, 0], x ∈ [0, 1]. We only need to determine a, b, c, d so that our function satisfies the definition of a spline. In the case we consider this means that, we have to check the continuity of the function, first and second derivative at x = 0. Also we will need S 00 (1) = 0 (remember, we are looking for natural cubic spline, i.e. S 00 (−3) = 0 = S 00 (1) = 0). To find a, b, c, d so that S, S 0 and S 00 are continuous at x = 0 we need to satisfy the equations: i.e. d = 6. S+ (0) = S− (0) 0 0 (0) = S− (0) i.e. c = 1. S+ 00 00 (0) = S− (0) i.e. b = 6. S+ 6a + 12 = 0 a = −2. S 00 (1) = 0 Problem: Find the LU decomposition of the matrix 4 2 0 0 2 3 1 0 0 2 4 1 . 0 0 2 3 Solution: You can solve this problem by using the procedure we had used in class, or by using the procedure described in the book. You can also determine L and U in the following way: 0 d1 u1 0 4 2 0 0 1 0 0 0 l1 1 0 0 0 d2 u2 0 2 3 1 0 0 l2 1 0 0 0 d3 u3 = 0 2 4 1 . 0 0 0 d4 0 0 l3 1 0 0 2 3 Now just multiply the corresponding row and column to get the corresponding entry in the matrix on the right. In what follows m × n means that we multiply m-th row of L by the n-th row of U : 1 × 1 d1 = 4. 1 × 2 u1 = 2 2 × 1 l1 d1 = 2, l1 = 1/2. SOME PROBLEMS FOR THE FINAL EXAM PREPARATION 2×2 2×3 3×2 3×3 3×4 4×3 4×4 3 l1 u1 + d2 = 3, d2 = 2. u2 = 1 2l2 = 2, l2 = 1 l2 u2 + d3 = 4, d3 = 3 u3 = 1 l3 d3 = 2, l3 = 2/3. l3 u3 + d4 = 3, d4 = 7/3. Problem: Find both Newton’s form and Lagrange’s form of the polynomial of lowest degree passing through the points (−2, 9), (−1, 0), (1, 0), (2, 15). (You don’t need to simplify.) -2 -1 1 2 Solution We first write the interpolation table: 9 0 0 15 To determine the Lagrange form we have to write down the cardinal functions `i (x), i = 0, 1, 2, 3. Then the polynomial will be L(x) = 9`0 (x) + 0`1 (x) + 0`2 (x) + 15`3 (x) = 9`0 (x) + 15`3 (x). As you can see we only need `0 (x) and `3 (x). We have (x + 1)(x − 1)(x − 2) (x + 1)(x − 1)(x − 2) =− (−2 + 1)(−2 − 1)(−2 − 2) 12 (x + 2)(x + 1)(x − 1) (x + 2)(x + 1)(x − 1) = . `3 (x) = (2 + 2)(2 + 1)(2 − 1) 12 `0 (x) = The polynomial then is L(x) = −9 (x + 2)(x + 1)(x − 1) (x + 1)(x − 1)(x − 2) + 15 . 12 12 The Newtons form of the polynomial will be (n = 4) pn (x) = f [x0 ] + f [x0 , x1 ](x − x0 ) + . . . + f [x0 , x1 , . . . , xn ] n−1 Y (x − xk ). k=1 We construct the divided difference table x −2 −1 1 2 f [·] f [·, ·] f [·, ·, ·] f [·, ·, ·, ·] 9 9 −3 0 0 2 0 5 15 15 Problem: Suppose that f (x) is a smooth function. Give an estimate (as a power of h) on the difference between f [−h, 0, h] and 12 f 00 (0), where f [−h, 0, h] is the second divided difference of f . Try to justify your answer. Solution: The second divided difference is: f [−h, 0, h] = f (−h) − 2f (0) + f (h) . 2h2 4 FINAL FALL, 2001, INSTRUCTOR: LUDMIL ZIKATANOV We also know that f (x − h) − 2f (x) + f (x + h) + O(h2 ). h2 (We have done this in class several times, one can use Taylor formula to derive it). Take x = 0. A short answer to this problem is: The difference is estimated by h2 . A longer answer (with justification) would use the derivation of: f 00 (x) = f (x − h) − 2f (x) + f (x + h) + O(h2 ). h2 by Taylor formula, which follows: f 00 (x) = f (x − h) = 2f (x) = f (x − h) = f (x) − hf 0 (x) + 2f (x) f (x) + hf 0 (x) + h2 00 2 f (x) − h3 00 6 f (x) + O(h4 ). h2 00 2 f (x) + h3 00 6 f (x) + O(h4 ). Then do “first equation”+“third equation”- “second equation” and get the expression for f 00 . Problem: Find the LU decomposition of the matrix 4 −2 6 −2 2 −2 6 −2 15 Solution: Again there are several ways to determine this LU decomposition. A straightforward one is to determine lij , di and uij by multiplying the matrices below: d1 u12 u13 4 −2 6 1 0 0 l21 1 0 0 d2 u23 = −2 2 −2 . 0 0 d3 l31 l32 1 6 −2 15 Follow the following rule when you try to write the corresponding equations for lij , uij , di : First determine d1 . Then l21 followed by u12 . Then d2 . Now proceed with the third row in L and third column in U , i.e. First determine l31 , then l32 then u31 and u32 . Finally get d3 . This precisely follows the procedure we derived in class. The answer is: 1 0 0 4 −2 6 L = −1/2 1 0 , U = 0 1 1 . 3/2 1 1 0 0 5 Problem: Write down the formulas for the Newton and secant method applied to the function f (x) = exp(cos x) − x3 . (You don’t need to simplify.) To solve this problem one needs to know Newton’s and secant formulae. Newton formula approximates the root, by solving linear equation. This linear equation is is nothing else but the equation of the tangent line passing through (xk , f (xk ), which looks in the following way: y = f (xk ) + f 0 (xk )(x − xk ). Therefore xk+1 will be the solution of the above equation, namely, you put y = 0 and solve for x. This gives the Newton’s formula: xk+1 = xk − f (xk ) , f 0 (xk ) x0 given initial guess. SOME PROBLEMS FOR THE FINAL EXAM PREPARATION 5 The secant formula is obtained from this one by replacing f 0 (xk ) by a divided difference (one needs two points to get the divided difference, xk and xk−1 . Here is the secant method formula: Given x0 and x1 the sequence of the approximations to the root of f (x) = 0 is obtained via: f (xk )(xk − xk−1 . xk+1 = xk − f (xk ) − f (xk−1 ) To solve this problem you need just to substitute in these two formulae. Problem: Given the system of linear equation with a tridiagonal matrix: x1 b1 α1 β1 0 x2 b2 γ1 α2 β2 .. .. . . . .. .. .. . = . . γn−2 αn−1 βn−1 xn−1 bn−1 0 γn−1 αn xn bn Derive general formulae for the solution. Solution: This is in the book. You can proceed as follows: Perform couple of Gaussian-elimination steps and then observe the pattern and write the formulae for xi . 1 Problem: Derive a secant iteration formula, to compute 3 3 . Then set x0 = 1 and x1 = 2 and compute one step of the secant iteration. Solution: This is a simple application of the secant method for finding the root of the equation x3 − 3 = 0. Problem: R4 (1) Write down the composite trapezoid rule and use it to approximate 0 2x dx using two and four equal-length intervals. (2) Apply the Romberg extrapolation technique to get a better approximation R4 to 0 2x dx. Solution: For part (a), the solution is straightforward by using composite trapezoidal rule with n = 1 and n = 2 (formula (1) page 211). You have to compute R(1, 0) and R(2, 0). For part (b) use formula (2) page 211 to get R(2, 1) = R(2, 0) + 13 (R(2, 0) − R(1, 0). Problem: (1) Find a polynomial L2 (x) of degree two such that Z 1 L2 (x)xk dx = 0, k = 0, 1. L2 (1) = 1; 0 (note that the interval is now [0, 1]). (2) Let x0 and x1 be the roots of L2 (x). Derive an integration formula of the form Z 1 f (x)dx ≈ A0 f (x0 ) + A1 f (x1 ) 0 such that it is accurate for polynomials of as high a degree as possible; what is the highest degree of polynomials for which the formula is exact ? 6 FINAL FALL, 2001, INSTRUCTOR: LUDMIL ZIKATANOV Solution: This problem is similar to the first one (but simpler). Try to solve it by following the procedure from the solution of the first problem. Pay attention to the fact that the interval is not [−1, 1] but all the integration should be performed on [0, 1]. It is also possible to solve this problem by using what you know for the interval [−1, 1]. A simple change of variables will yield the values of x0 and x1 . Then the polynomial will be c(x − x0 )(x − x1 ), where the constant is determined by the condition L2 (1) = 1. Problem: Write a formulae to compute to solve a n × n backward tridiagonal system of linear equations: a1 d1 b1 x1 a2 d2 c2 x2 b2 a d3 c3 b3 3 x 3 . ··· ··· ··· .. = .. . . an−2 dn−2 cn−2 xn−1 bn−1 an−1 dn−1 cn−1 xn bn dn cn Solution: This problem is not complicated at all. You start by permuting the rows of the matrix (the n-th row becomes 1-st, n − 1-st becomes second, etc. This will give you a tridiagonal matrix. Get the formulae for tridiagonal matrix and write the solution. Problem: (1) Find the LU factorization for the matrix 6 −1 8 A = 2 −3 3 2 −1 2 (2) Use the above LU factorization to solve the equation Ax = b with b = (6, 5, 28)t. Solution: The LU decomposition is: 1 0 0 6 L = 1/3 1 0 , U = 0 1/3 1/4 1 0 −1 8 −8/3 1/3 . 0 −3/4 The solution of the corresponding system is x = (1, 2, 3)t . You can find this solution by first solving Ly = b, and find that y = (28, −13/3, −9/4). Then you obtain x such that U x = y. Problem: Q0 (−1) = 0 Find a quadratic spline interpolating the table and such that t −1 0 1 y 13 7 9 SOME PROBLEMS FOR THE FINAL EXAM PREPARATION 7 Solution: Proceed by definition. You need to find a function Q(x) which is piece-wise quadratic (namely a quadratic polynomial Q1 (x) on [−1, 0] and another quadratic polynomial Q2 (x) on [0, 1]) such that they satisfy the interpolation and Q1 (−1) = 13, Q1 (0) = Q2 (0) = 7, and the smoothness condition 0(0) Q2 (1) = 9. 0(0) Q1 = Q2 . Both Q1 and Q2 are quadratic polynomials as stated above, and therefore Q(x) should have the form: a1 x2 + b1 x + c1 , x ∈ [−1, 0] Q(x) = a2 x2 + b2 x + c2 , x ∈ (0, 1] Let us use the interpolation and smoothness conditions and try to determine ai , bi and ci . We have a1 − b1 + c1 = 13 c 1 = c2 = 7 a 2 + b 2 + c2 = 9 b1 = b2 , from the condition for the derivatives. −2a1 + b1 = 0, from Q0 (x) = 0. Let us set b1 = b2 = b. Then we have the following equations: a1 − b = 6, a2 + b = 2, b = 2a1 . This gives the solution: a1 = −6, b1 = b2 = b = −12, c1 = 7 c2 = 7. a2 = 14, Finally the spline is Q(x) = −6x2 − 12x + 7, x ∈ [−1, 0] 14x2 − 12x + 7. x ∈ (0, 1] Problem: Determine a, b and c and d so that 3 0≤x<3 x , S(x) = a + b(x − 3) + c(x − 3)2 + d(x − 3)3 , 3 ≤ x ≤ 4 is a natural cubic spline. This we have solved in class with 2 instead of 3. Here one more coefficient d is unknown, but you have one more condition, namely the spline has to be natural, i.e. S 00 (4) = 0.
© Copyright 2025 Paperzz