 # Computer Science 2 â Test no 1 - C-CFD

```Computer Science 2 – training problems for the TEST 1
Problem 1: Using the Lagrange’s method, calculate the polynomial which interpolates
through the following points: (a) (1,1), (3,0) and (4,-1) , (b) (0,-2), (2,4) and (5,-1) , (c) (-3,-2),
(0,4), (3,-2)
Problem 2: What is the Runge effect? What kind of remedy could you suggest to avoid this
effect?
Problem 3: Calculate the interpolating polynomials for the same nodes as in the Problem 1
using the Newton method.
Problem 4: The function f(x) has been approximated in the interval (-h,h) by the quadratic
polynomial interpolating through the points (-h,f(-h)), (0,f(0)) and (h,f(h)). Show that the
value of the second derivative of the function f at x = 0 can be approximated by the formula
f (0) 
f ( h)  2 f (0)  f (h)
h2
Problem 5: Write a general formulation of the linear regression problem (the least-squares
approximation by a linear function). The given nodes are {(x0,y0), (x1,y1), .. , (xM,yM)}. Find
explicit formulas for the coefficients of this linear function.
Problem 6: Find the least-squares solution of the following overdetermined problem
(a)
 1 2 
0
 2 1   x1   0 , (b)

  x2   
 3 2 
1
 0 1
1 
 2 0  x1   0

  x2   
 1 1
0
Problem 7: The inner product of two polynomials v(x) and w(x) is defined as
v, w : v( 2)  w( 2)  v(0)  w(0)  v(2)  w(2)
We say that v(x) and w(x) are orthogonal if v, w  0 . Consider two polynomials:
p0 ( x )  1 and p1 ( x )  x . Find the polynomial of the second order p 2 ( x ) such that
p0 , p 2  p1 , p2  0 and p 2 , p 2  1 .
Problem 8: Derive the formula of the (simple) Simpson integration rule.
Problem 9: Show that the Simpson rule can be obtained as an appropriate weighted average
of the mid-point and trapezoidal rules. Using the error estimations for mid-point and
trapezoidal rules show that the order of the Simpson rule is larger than 1.
Problem 10: The integration error of the composite trapezoidal method using a uniform
division of the integration interval can be expressed as E (h)  c1h 2  c2h 4  c3h6  ... , where h
is the length of the elementary interval. Explain how to obtain approximate value of the
integral which error shrinks with h as: a) h4, b) h6.
Problem 11: We want to integrate exactly polynomials of the order up to 15. To this aim we
can use the Gauss integration. What is the minimal number of the integration nodes necessary
1
Problem 12: Derive the composite trapezoidal formula for the integral
x
2
dx , using
0
uniformly spaced nodes x0, x1, ...,xn. Calculate the difference between the approximate and
exact values of this integral and show that the error is proportional to n-2. Hint: use the
1
summation formula: 12  2 2  ...  ( n  1) 2  ( n  1)n(2n  1) , valid for every natural n  2.
6
Problem 13: Write the formula of the composite Simpson method applied to uniform division
of the integration interval [a,b] into 2M segment, each of the length equal h=(b-a)/2M. How
any times the error of this method is expected to diminish if we divided the interval [a,b] into
Problem 14: Write the iterative formula of the Newton method (the method of tangent lines)
generally and apply it to the nonlinear equation x 2  2sin 2 x  1  0 .
Problem 15: Explain the concept of quadratic convergence. When the Newton method is
1
applied to the equation ( x  w) 2  0 , we obtain x n 1  x n  ( x n  w) . Subtracting the root
2
1
w from both sides yields x n 1  w  ( x n  w) , i.e. the error is reduced at constant rate by
2
the factor of 1/2 per each iteration. This means that the Newton method applied to this
particular problem fails to achieve quadratic convergence rate (it is actually only linearly
convergent). Explain why it happens.
Problem 16: We want to find numerically the square root of the number w  0 . Using the
Newton method show that this task can be accomplished by iterating the following formula
1
w
xn 1   xn   . What is the rate of convergence of this process?
2
xn 
Problem 17: Explain graphically the “mechanics” of the methods of secants and derive the
analytic formula of this method. Explain the concept of the superlinear convergence rate.
Problem 18: We have the function f ( x )  x 2  a x , with the number a given. Consider the
equation f(x) = 0. In order to find a nonzero solution (obviously equal to the constant a), one
could replace the original equation with the equivalent one in the form of x  g( x ) and then
use the method of direct iterations x n1  g(x n ) . For instance, we can consider two
1
1
a
possibilities: (P1) x n 1  x 2n , (P2) x n 1  x 2n  (1  ) x n , where  is a smartly chosen
a


number. Show that the iterative process (P1) never converges to the root x *  a . Assume that
1
a > 0. Show that the iterative process (P2) converges locally to x *  a if    a .
2
``` # Homework 3 - Math 321, Spring 2015 Due on Friday January 30 1 