selection

15
MATH20602 - 2014 A selection of old exam questions These are extracts from previous exam questions, not complete questions. These questions are for training purposes. By no means do they cover all the relevant material, and the material covered may not necessary feature in the exam. The format of this collection is not the format of the exam. 1

Upload: muhammad-kamran

Post on 01-Oct-2015

233 views

Category:

Documents


6 download

DESCRIPTION

Questions on Interpolation

TRANSCRIPT

  • MATH20602 - 2014

    A selection of old exam questions

    These are extracts from previous exam questions, not complete questions. These questions are for training purposes. By no means do they cover all the relevant material, and

    the material covered may not necessary feature in the exam.

    The format of this collection is not the format of the exam.

    1

  • MATH20602 - 2014

    1. (from May 21, 2010)State Lagranges formula for the interpolating polynomial of degree n or less pn(x) which passes throughthe points (xi, f(xi)), i = 0, 1, . . . , n, where all the points xi are distinct.

    The following is a partial tabulation of the function f(x) = ln(1 + x):

    x 0.3 0.4 0.6 0.7f(x) 0.2624 0.3365 0.4700 0.5306

    Using all four of these points in Lagranges formula, estimate ln(1.5).

    Solution 1. The Lagrange interpolation formula is given by

    pn(x) =ni=0

    Li(x)f(xi),

    where

    Li(x) =nj=1j 6=i

    (x xj)(xi xj) .

    For evaluating ln(1.5), we compute pn(x) for x = 0.5 (as pn(x) interpolates f(x) = ln(1 + x)) using thefollowing table:

    xi f(xi) x xi Li(x) Li(x)f(xi)0.3 0.2624 0.2 1

    60.04373

    0.4 0.3365 0.1 23

    0.22433

    0.6 0.4700 0.1 23

    0.31333

    0.7 0.5306 0.2 16

    0.08843= 0.4055

    As indicated, the interpolating polynomial evaluated at x = 0.5 is the sum of the last column, so we havethe approximation ln(1.5) 0.4055.

    2

  • MATH20602 - 2014

    2. (from May 22, 2012)

    (a) Define the divided differences f [xi, xi+1, . . . , xi+k] for a function f(x).

    (b) Consider the quadratic polynomial

    p2(x) = f [x0] + f [x0, x1](x x0) + f [x0, x1, x2](x x0)(x x1).

    Show that this polynomial interpolates f(x) at the points (xi, f(xi)), i = 0, 1, 2.

    (c) Use divided differences to construct the quadratic polynomial p2(x) that passes through the points

    (0.1, 0.1248), (0.2, 0.2562), and (0.4, 0.6108).

    (d) Given that all these points lie on the curve y = f(x), use the polynomial p2(x) of the previous part toestimate f(0.3).

    Solution 2. (a) The divided differences f [xi, . . . , xi+k] are defined as follows:

    f [xi] := f(xi),

    f [xi, xi+1] :=f [xi+1] f [xi]xi+1 xi ,

    f [xi, xi+1, . . . , xi+k] : =f [xi+1, xi+2, . . . , xi+k] f [xi, xi+2, . . . , xi+k1]

    xi+k xi .

    (b) The Newton interpolation polynomial of degree 2 is defined as

    p2(x) = f [x0] + f [x0, x1](x x0) + f [x0, x1, x2](x x0)(x x1).

    It is required to satisfy the interpolation condition p2(xi) = f(xi) for i = 0, 1, 2. We verify this as follows:

    p2(x0) = f [x0] + 0 + 0 = f(x0),

    p2(x1) = f [x0] + f [x0, x1](x1 x0) = f(x0) + f(x1) f(x0)x1 x0 (x1 x0) = f(x1), (0.1)

    and

    p2(x2) = f [x0] + f [x0, x1](x2 x0) + f [x0, x1, x2](x2 x0)(x2 x1)= f [x0] + f [x0, x1](x2 x0) + f [x1, x2] f [x0, x1]

    x2 x0 (x2 x0)(x2 x1)= f [x0] + f [x0, x1](x2 x0) + f [x1, x2](x2 x1) f [x0, x1](x2 x1)= f [x0] + f [x0, x1](x1 x0) + f [x1, x2](x2 x1)= f(x1) +

    f(x2) f(x1)x2 x1 (x2 x1) (we used identity ( 0.1) here)

    = f(x2).

    3

  • MATH20602 - 2014

    (c) The divided difference table for the given points is

    0.1 0.12481.314

    0.2 0.2562 1.531.773

    0.4 0.6108

    The Newton interpolation polynomial has the form

    p2(x) = 0.1248 + 1.314(x 0.1) + 1.53(x 0.1)(x 0.2).

    (d) Evaluated at x = 0.3 we get

    p2(0.3) = 0.1248 + 0.2 1.314 + 0.1 0.2 1.53 = 0.4182.

    4

  • MATH20602 - 2014

    3. (from May 21, 2010)The integral

    21exxdx is to be estimated using the Composite Trapezium Rule xn

    x0

    f(x) dx h2

    (f(x0) + 2

    n1j=1

    f(xj) + f(xn)

    ),

    where xj = x0 + jh, j = 0, 1, . . . , n and h is the constant step size. The error in this quadrature rule isgiven by

    112

    (xn x0)h2f ()for some (x0, xn). Find the largest value of h that can be used if the error in the estimate is to be nomore than 5 104 in modulus.

    Solution 3. The derivatives of f(x) are given by

    f (x) = ex(1

    x+

    1

    x2

    ),

    f (x) = ex(1

    x+

    2

    x2+

    2

    x3

    ).

    As f (x) is decreasing on the interval [1, 2], it takes its largest value at x = 1 in that interval. Hence,

    |f (x)| e1(1 + 2 + 2) = 5e1 1.84, x [1, 2].

    Let E(h) be the error term in the composite trapezium rule with step length h. Then

    |E(h)| 112h2 1.84.

    We require that1

    12h2 1.84 5 104.

    This is satisfied if h 5.7 102.

    5

  • MATH20602 - 2014

    4. (from June 3, 2011)

    (a) The numerical integration formula h0

    x12f(x) dx h 32 (f(0) + f(h)) + h 52 (1f (0) + 1f (h))

    is exact when f(x) = xr for r = 0, 1, 2, 3. Show that = 1663

    and = 2663

    and find the values of 1and 1.

    (b) Obtain an approximation for pi2

    0

    x12 sin(x) dx

    by using the formula derived above. (Give three significant figures in your answer.)

    Solution 4. (a) The idea here is to use the exactness conditions to build a system of equations that has the un-known parameters , , 1, 2 as solutions. We start by comparing the exact integrals with the interpolantsfor f(x) = 1, x, x2, x3.

    The exact integrals are h0

    x12 dx =

    2

    3h

    32 ,

    h0

    x12 x dx = 2

    5h

    52 , h

    0

    x12 x2 dx = 2

    7h

    72 ,

    h0

    x12 x3 dx = 2

    9h

    92 .

    If we denote the interpolants by I(f), then the interpolants are given by

    I(1) = h32 ( + ), I(x) = h

    32h+ h

    52 (1 + 1)

    I(x2) = h32h2 + 2h

    521h, I(x

    3) = h92 + 3h

    521h

    2.

    Comparing these expressions, we get the conditions:

    + =2

    3, + 1 + 1 =

    2

    5

    + 21 =2

    7, + 31 =

    2

    9.

    These are four equations in four unknowns. Subtracting the last from the third one, we get

    1 =2

    9 2

    7= 4

    63

    and plugging this into one of the last two,

    =26

    63.

    Plugging these values into the first two equations, we get

    =16

    63, 1 =

    16

    315.

    6

  • MATH20602 - 2014

    (b) Setting h = pi2

    and f(x) = sin(x), f (x) = cos(x), the numerical integration formula reads pi2

    0

    x12 sin(x) dx

    (pi2

    ) 32

    (16

    63sin(0) +

    26

    63sin(pi/2)

    )+(pi2

    ) 52

    (16

    315cos(0) 4

    63cos(pi/2)

    )=

    26

    63

    (pi2

    )3/2+

    16

    315

    (pi2

    ) 52= 0.9695556

    7

  • MATH20602 - 2014

    5. (from May 21, 2010)Solve the following system of simultaneous linear equations by carrying out two iterations of the Gauss-Seidel method using the initial vector (0.3, 0.3, 0.25)>:20 8 04 20 4

    0 4 20

    =x1x2x3

    =665

    .Show that the Gauss-Seidel method will converge from any initial vector x0 for this set of equations.

    Solution 5. The Gauss-Seidel method carries out iterations of the form

    xn+1 = Txn + c,

    withT = (L+D)1U , c = (L+D)1b.

    and A = L+D +U with L,D and U denoting the lower triangular, diagonal, and upper triangular parts,respectively.

    We can also write this iteration in terms of the individual components of the vectors being iterated. Thecomponentwise version of the Gauss-Seidel iteration scheme for this system of equations is given as

    x(k+1)1 =

    1

    20

    (6 + 8x

    (k)2

    )x(k+1)2 =

    1

    20

    (6 + 4x

    (k+1)1 4x(k)3

    )x(k+1)3 =

    1

    20

    (5 + 4x

    (k+1)2

    ).

    Starting with the initial value x0 = (0.3, 0.3, 0.25)>, we get

    x(1)1 =

    1

    20(6 + 8 0.3) = 0.42

    x(1)2 =

    1

    20(6 + 4 0.42 4 0.25) = 0.3340

    x(1)3 =

    1

    20(5 + 4 0.3340) = 0.3168.

    and

    x(2)1 =

    1

    20(6 + 8 0.42) = 0.4336

    x(2)2 =

    1

    20(6 + 4 0.4336 4 0.3168) = 0.3234

    x(2)3 =

    1

    20(5 + 4 0.3234) = 0.3147.

    The method converges if and only if (T ) < 1. To verify this, we compute the eiganvalues of T as theroots of the polynomial

    det((L+D) +U) = 0.

    8

  • MATH20602 - 2014

    Written out, this determinant looks like

    det

    20 8 04 20 40 4 20

    = 20(4002 + 16) + 8(802)= 80003 3202 = 0.

    Two of the roots are 0, while the third root is

    =320

    8000= 0.04.

    This is also the value of the spectral radius, which is clearly < 1, and therefore the method converges.Alternatively, we can read out an expression for the matrix T from the componentwise iteration:

    T =1

    5

    0 2 00 151

    0 2251

    5

    .Then one can compute any norm (for example, the-norm T ) to see the norm criterium for conver-gence applies. With the above matrix, clearly T < 1, so we have convergence with respect to the-norm and therefore also with respect to the 2-norm.

    9

  • MATH20602 - 2014

    6. (from May 22, 2012)

    (a) Calculate A1 and A2 for the matrix

    A =

    (1 23 4

    ).

    (b) Define the condition number of A, denoted by condp(A), for p = 1, 2, . . . .

    (c) Explain what is meant by saying that the system of linear equations Ax = b is ill-conditioned.

    Solution 6. (a) The 1 is the maximum of the sum of the absolute values of the columns of A. In our case,

    A1 = max{4, 6} = 6.

    For the 2-norm, we use the identityA2 = (A>A)1/2.

    We compute

    A>A =(

    10 1414 20

    )The eigenvalues of this are given by

    det(I A>A) = 0.This leads to the quadratic equation 2 30 + 4, which has the roots = 15 221. Therefore,A2 = 5.46499.

    (b) The condition number is defined as

    condp(A) =A1

    p Ap .

    (c) A system of linear equations Ax = b is ill-conditioned, if a small change in the system (that is, in Aor b) can lead to a big change in the solution of the system. As small changes are unavoidable in numericalcomputations, the computed solution (by any algorithm) may be a poor approximation of the true solutionif the system is ill-conditioned. Moreover, small residuals (Axb) may not necessarily lead to small errorsin the computed solution.

    10

  • MATH20602 - 2014

    7. (from May 21, 2010)Show that the equation

    x3 2x 2 = 0has a root between 1 and 2. By calculating the maximum and minimum values of x3 2x 2, show thatthis is the only real root.

    Consider the following iteration schemes for computing the real root of the above equation:

    (a) xn+1 = 12(x3n 2), n = 0, 1, . . .

    (b) xn+1 = (2xn + 2)13 , n = 0, 1, . . . ,

    (c) xn+1 =2x3n+23x2n2 , n = 0, 1, . . . .

    Show that for one of these schemes the fixed point theorem does not guarantee convergence, one willconverge linearly, and one will converge quadratically.

    Solution 7. The functionf(x) = x3 2x 2

    satisfies f(1) = 3 and f(2) = 2. The sign changes between 1 and 2 (f(1)f(2) < 0), and by the meanvalue theorem and the fact that the function is continuous, it must have a root in that interval. The derivativeis given by 3x2 2. Setting this to zero, we see that we have critical points at x = 2/3. Looking at thesecond derivatives, we see that x1 =

    2/3 is a local minimum, while x2 =

    2/3 is a local maximum. It

    follows that on the interval [1, 2] the function f(x) is strictly monotonically increasing (otherwise it wouldhave a critical point in that interval), and can therefore only have one root.

    In the following, we verify the conditions of the fixed point theorem.

    g(x) = 12(x3n 2). We first verify that a fixed point of this is indeed a root to the above equation

    f(x) = 0. Note thatx = g(x) 2x = x3 2 f(x) = 0.

    Lets verify the conditions of the fixed-point theorem. We have g(1) = 12

    and g(2) = 3, both outsidethe interval [1, 2]. The derivative g(x) = 3x/2 also fails the condition |g(x)| < 1 in any intervalaround the root in [1, 2], so we cant deduce convergence.

    g(x) = (2x+ 2) 13 . The fixed point satisfiesx = g(x) x3 = 2x+ 2 f(x) = 0.

    We next very the conditions of the fixed-point theorem on the interval [1, 2]. We have g(1) = 1.5874and g(2) = 1.8171, and since the function is monotonically increasing in [1, 2], it stays within thisinterval. Finally, we have

    g(x) =2

    3(2x+ 2)

    23 ,

    which clearly satisfies |g(x)| < 1 on [1, 2], since 2x+2 > 1 and therefore 1/(2x+2)2/3 < 1 on thatinterval. By the fixed-point theorem, this iteration converges linearly. Note that the iteration may alsoconverge quadratically. As we will see, the iteration from (c) converges quadratically, so we dontbother in verifying this in this part.

    11

  • MATH20602 - 2014

    g(x) = 2x3+23x22 . First of all, note that a fixed point satisfies

    x =2x3 + 2

    3x2 2 3x3 2x = 2x2 + 2 f(x) = 0,

    so a fixed point is indeed a root of f(x). Next, lets see if we can verify quadratic convergence. Fromthe lecture notes (Lecture 17) we know that the fixed point iteration converges quadratically if, at thefixed-point , we have

    g() = 0.

    The derivative of g is given by

    g(x) =6x2

    3x2 2 (2x3 + 2)6x

    (3x2 2)2 =6x

    3x2 2(x 2x

    3 + 2

    3x2 2)=

    6x

    3x2 2(x g(x)).

    If is a fixed-point, that is, = g(), then clearly g() = 0. It follows that we have quadraticconvergence for a starting point that is close enough to .

    Note that if we write down Newtons formula for the function f(x), we get

    g(x) = x f(x)f (x)

    = x x3 2x 23x2 2 =

    2x3 + 2

    3x2 2 .

    That is, the iteration xn+1 = g(xn) is precisely the fixed-point formulation for Newtons method.

    12

  • MATH20602 - 2014

    8. (based on May 22, 2012)Use the Newton iteration (also called Newton-Raphson) method to find (correct to three significant figures)a root of the equation F (x) = 0 near x = 2, when

    F (x) = x2 + 10 cos(x).

    (Here, x is measured in radians).

    Solution 8. Given the function F (x) = x2 + 10 cos(x), the derivative is F (x) = 2x 10 sin(x) andNewtons method is the fixed-point iteration for the function

    g(x) = x f(x)f (x)

    = x x2 + 10 cos(x)

    2x 10 sin(x) .

    Starting with x0 = 2, we obtainx1 = 1.9683, x2 = 1.9689.

    As x1 and x2 agree to three significant figures, the required root is 1.97 (to three significant figures).

    13

  • MATH20602 - 2014

    9. (from May 21, 2013) A quadrature rule I(f) has degree of precision k on [0, 1], if it evaluates the integral 10f(x) dx exactly for polynomials of degree up to k. Determine a value of [0, 1] such that the degree

    of precision of the quadrature rule

    I(f) =2

    3f () 1

    3f (1/2) +

    2

    3f (1 )

    on the interval [0, 1] is at least two.

    Solution 9. The answer isI(f) =

    2

    3f (1/4) 1

    3f (1/2) +

    2

    3f (3/4) ,

    that is, = 1/4. To determine this, we first evaluate the integrals of 1, x, x2: 10

    1 dx = 1,

    10

    x dx =1

    2,

    10

    x2 dx =1

    3.

    We then write down the quadrature rule

    I(1) =2

    31 1

    31 +

    2

    31 = 1,

    I(x) =2

    3 1

    3

    1

    2+

    2

    3(1 ) = 1

    2,

    I(x2) =2

    32 1

    3

    1

    4+

    2

    3(1 )2 = 1

    3,

    The first equation is always satisfied. The second equation is also satisfied, since + 1 = 1. From thethird one we get a quadratic equation

    162 16 + 3 = 0,which we see has solutions 1/4 and 3/4 in the interval [0, 1].

    14

  • MATH20602 - 2014

    10. (from May 21, 2013)

    (a) In order to solve the equationex

    2/2 3 cos(x2) = 0,perform two iterations of the bisection method with starting values 0.4, 1.8, followed by one itera-tion of Newtons method on the approximate value found with the bisection method (x measured inradians).

    (b) How does the Newton method behave if we choose x0 = 0.4 as starting point?

    Solution 10.

    (a) In order to solve the equationex

    2/2 3 cos(x2) = 0.by Newton, we need the derivative

    f (x) = xex2/2 + 6x sin(x2).

    Starting with 0.4 and 1.8, we get the iterates for the bisection method

    x f(x) lower bound upper bound0.4 2.03861.8 3.1838 0.4 1.81.1 0.5130 1.1 1.8

    and the estimate (1.1 + 1.8)/2 = 1.45 after the second iterate. Using this as starting point x0 inNewtons method

    x1 = x0 f(x0)/f (x0) = 1.45 1.8705/6.9921 = 1.1825.

    The function value at this point is f(1.1825) = 0.0180, already very close to zero.(b) At the point 0.4 the derivative is f (0.4) = 0.0131, very small. Consequently, applying a step of

    Newtons method we get0.4 f(0.4)/f (0.4) = 155.8121.

    We end up very far from our original point.

    15