You are on page 1of 8

EEM2036: Numerical Methods Tutorial

MULTIMEDIA UNIVERSITY
EEM2036: Engineering Mathematics III
Tutorial: Numerical Methods

1. Find the largest interval in which p * must lie to approximate p with relative error at most
10 −4 for each value of p .
3
(a) e (b) 7
Sol: [2.718010,2.718554]; [1.912740,1.913122] ;
1  3  3
2. Use three-digit rounding arithmetic to calculate  + 4  − . Compute the absolute
 3  11  19
error with the exact value determined to at least five digits.
−2
Sol: 1.26; 0.63477 × 10

3
3. Use four-digit chopping arithmetic to calculate − 10π + 6e − . Compute the relative
62
error with the exact value determined to at least five digits.
−3
Sol: −15.15; 0.305034 × 10

4. Let f ∈ C [a, b] be a function whose derivative exists on (a, b ) . Suppose f is to be


evaluated at x0 in (a, b ) , but instead of computing the actual value f ( x0 ) , the approximate
~ ~
value, f ( x0 ) , is the actual value of f at x0 + ε , that is, f ( x0 ) = f ( x0 + ε ) .
~
(a) Use the Mean Value Theorem to estimate the absolute error f ( x0 ) − f ( x0 ) and the
~
relative error f ( x0 ) − f ( x0 ) f ( x0 ) , assuming f ( x0 ) ≠ 0 .
If ε = (5 × 10 −6 )x 0 and x0 = 1 ,
(i) find bounds for the absolute error of f ( x ) = sin x ,
(ii) find bounds for the relative error of f ( x ) = cos x ,
Does the bound bracket the absolute errors and relative errors calculated?
−5 −5
Sol: absolute error: 0.27015 × 10 ; bound: 0.2701511530 × 10 ;
−6 −5
relative error: 0.77870511 × 10 ; bound: 0.7787062318 × 10 .

5. Define
1 − cos( x ) [sin (x ) x] ,  sin ( 2x )
2 2

f (x ) = , g ( x ) = h ( x ) = 2  x  .
x2 1 + cos x  
(a) Show that f ( x ) = g ( x ) = h( x ) , if they exists for the x in the question.
(b) Identify, for each of f, g and h, those ranges of x, if any, which lead to subtractive
cancellation when they are evaluated as they stand.
[Final Examination; Trimester 1 Session 1999/2000]

6. Explain why the following floating point operations are “dangerous, and how we can
rewrite the following expressions to avoid errors coming from floating-point arithmetic.
(a) cos2θ − sin2θ (b) ln x – ln y
(c) 1− 1+ x
x
(d) 9 + x2 − 3

Trimester 1, Session 2010/11 1


EEM2036: Numerical Methods Tutorial

7. Compute the missing values in the following table.

f (x ) ∆f ( x ) ∆2 f ( x )
.
.
. 1
.
. −4
4
−6 7
.
. 10
.
. 19
.
.
Sol: f ( x ) : −25, −18, −10,6,5,26,66

8. Prove that
n −1
(a) ∑ ∆ f (x ) = ∆f (x ) − ∆f (x ).
k =0
2
k n 0 [Final examination; Trimester 1, Session 2000/01]

(b) ∇[ f ( x )g ( x )] = g ( x − 1)∇f ( x ) + f ( x )∇g ( x ) [Final examination; Trimester 1, Session 2000/01]

9. The values of f ( x ) given below are those of a certain polynomial of degree 4. Form a
difference table, and from this table find f (5) .

x 0 1 2 3 4
f (x ) 1 5 31 121 341
Sol: 781.

10. Write the Lagrangian interpolating polynomial that passes through each point:

x –2.3 0.5 2 3.1


f (x ) 2.1 –1.3 15 31

Leave your answer in Lagrangina form. Plot the points, and sketch the polynomial that
passes through them.

11. Use Lagrange interpolating polynomial of degree one to approximate f (0.9 ) if


f (0.7 ) = 1.042829 , f (0.8) = 1.078390 and f (1.0) = 1.103638 .
Sol: If x 0 = 0.8 and x1 = 1.0 , then P1 (0.9 ) = 1.091014;

12. Use Lagrange interpolation to approximate 3 with the function f ( x ) = 3 x and nodes
x0 = 0 , x1 = 1 and x 2 = 2 .
Sol: P2 (0.5) = 1.5
Trimester 1, Session 2010/11 2
EEM2036: Numerical Methods Tutorial

13. Construct a divided-difference table from:

x 0.5 –0.2 0.7 0.1 0


f (x ) –1.15 0.70 –1.48 –0.14 0.13
Sol: f[, , , ,]: 1.997354;

14. Complete the following divided-difference table.


xk f[] f[,] f [, , ] f [, , , ] f [, , , , ]
1 0
341
4 . .
781 .
3 . . .
. .
–1 –2 50
11
. .
Sol: f[ , , ,] : 38, 47; f[, , , ,]: 9;

15. Construct the interpolating polynomial for the unequally spaced points in the following
table:
x –2 –1 0 2
f (x ) 46 5 0 2
If f (1) = 1 is added to the above table, construct the new interpolating polynomial.
Sol: P3(x) = 46 – 41(x+2) + 18(x +2)(x+1) – 4(x+2)(x+1)x; P4(x) = P3(x) + x(x+2)(x+1)(x–2)

16. Let P3 ( x ) be the interpolating polynomial for the data (0,0 ) , (0.5, y ) , (1,3) and (2,2 ) .
Find y if the coefficient of x3 in P3 ( x ) is 6.
Sol: 4.25

17. Approximate f (0.75) using the following data and the Newton forward-difference
formula.:
x 0 1 2 3
f (x ) 0 1 16 63

Use the Newton backward-difference formula to approximate f(2.5).


Sol: 0.140625, 34.375

18. The production of a semiconductor component at a factory in the year 2005 is given below:

Month February March April June


Volume of production 12 13.4 11.5 12.5
(in millions of units)

By using interpolating polynomial of degree three, approximate the volume of the


production in May 2005. [Final examination; Trimester 1, Session 2006/07]
Sol: 9.975 millions

Trimester 1, Session 2010/11 3


EEM2036: Numerical Methods Tutorial

19. The following data is taken from a polynomial.


x −1 0 2 3 4 7
f (x ) 6 5 21 38 61 166
What can you say about its degree? Explain your answer.
Sol: degree 2 or higher than 5

20. Let f ( x ) = x ln x and P2 ( x ) be the interpolation polynomial on x0 = 1, x1 and x 2 = 2 .


Find the largest value of x1 in (1,2) for which f (1.5) − P2 (1.5) = 0.01 .
Sol: 1.74

21. The data for question 11 were generated using the function f ( x ) = 3 xe − x . Use the error
formula to find a bound for the error and compare the bound to the actual error.
−2 −2
Sol: Absolute error = 0.672416 × 10 Error bound = 0.808792 × 10 .

22. Determine the error bound for linear interpolating polynomial in approximating
f ( x ) = sin ( x − 2 ) for an x in [ −6π , π6 ] , Your answer should be in term of h, where
h = x1 – x0.
Sol: h2/8

23. Suppose you need to construct a table of equally spaced values for the common logarithm
function from x=1 to x=10, so that interpolation with a linear interpolation in this table is
accurate to within 10-6. Determine a suitable bound for the step size for this table.
Sol: 4 × 10-3

24. Use the central-difference formula with h = 0.01 and 0.001 to estimate f ′(0.66) if
x
e
f (x ) = . Compare the absolute error for the case of h = 0.01 and 0.001.
( x − 2)
−3
Sol: − 2.521612 Absolute error: 0.218374 × 10 ;
−5
− 2.521396. Absolute error: 0.218352 × 10 ;

25. By using forward or backward numerical differentiation, complete the following table:

x f (x ) f′ (x)
0.0 0.00 000
0.2 0.74 140
0.4 1.37 182

If the data were taken from f ( x ) = e x − 2 x 2 + 3 x − 1 , compute the error bound and compare
with the actual error.
Sol:Forward 3.7070, 3.1521; Error bound: 0.300000, 0.277860; Absolute error: 0.293000; 0.269293;
Backward: 3.7070; 3.1521;Error bound: 0.300000, 0.277860; Absolute error: 0.285597, 0.260275.

26. Derive a 3-point formula that uses f ( x0 ) , f ( x1 ) and f ( x2 ) to approximate


(a) f ′( x0 ) , and
(b) f ′( x 2 ) ,

Trimester 1, Session 2010/11 4


EEM2036: Numerical Methods Tutorial
Where x1 − x0 = x 2 − x1 = h .

27. Use the formula derived in question 26 and central difference formula to approximate
f ′( x ) in the following table:

x f (x ) f ′( x )
2.0 5.947734
2.1 6.423753
2.2 6.922009

Given that f ( x ) = e
x
3
+ x 2 , compute the absolute error and compare with the error bound.
Sol: 4.649005; 4.871375; 5.093745;
0.239680 × 10 , 0.124097 × 10 −3 , 0.258028 × 10 −3
Absolute error:
−3

−3 −3 −3
Error bound: 0.257038 × 10 , 0.128519 × 10 , 0.257038 × 10

1
3.5
28. Approximate ∫
3.0 x − 1.5
dx by using the trapezoidal rule and Simpson’s rule with one
interval. Find a bound for the error for both methods.
Sol:0.291667;0.6173 × 10-2; 0.287698, 0.342935 × 10-4

29. By using the composite trapezoidal rule and the composite Simpson’s rule, approximate
2

2
x 2 e − x dx with
0
(a) 2 intervals (b) step size h = 0.25
Sol: (0.404511, 0.422736), (0.421582, 0.422716)

30. Suppose that f (0.25) = f (0.75) = α . Find α if the Composite Trapezoidal rule with n = 2

∫ f (x ) dx
1
gives the value 2 for and with n = 4 gives the value 1.75.
0
Sol: 1.5

31. Determine the smallest number of intervals n and h, where h =


(π6 ) − ( −6π ) , so that the
2n
composite Simpson’s rule can be used to compute the integral
π
6

∫ cos x
−π
dx
6

with an accuracy of 5 × 10 −9. [Final examination, Trimester 1, Session 2000/01]; Sol: 18

32. Given that


x f (x)
1.0 0.4596698
1.2 1.365642
1.4 2.574033
1.6 4.125200
1.8 6.059202
2.1 9.765846
2.4 14.561390

Trimester 1, Session 2010/11 5


EEM2036: Numerical Methods Tutorial
By using all of the above data and the trapezoidal method, find an approximate value of
2.4

∫ f (x ) dx .
1.0
[Final examination, Trimester 2, Session 2000/01]
Sol: 8.287708

33. Approximate the following integrals using Gaussian quadrature.


1 1
(a) ∫-1
e x dx , with n = 2. (b) ∫ 0
e x dx , with n=3.
π
∫ (cos x )
/4 2
(c) dx , with n=4.
0
Sol: 2.342696, 1.718281, 0.642699

34. Find the constants c0, c1 and x1 so that

1
∫ 0
f ( x )dx = c0 f (0) + c1 f ( x1 )

has the highest possible degree of precision.


Sol: 1/4, 3/4, 2/3, 2

35. Determine constants a, b, c and d that will produce a quadrature formula


1
∫ −1
f ( x )dx = af ( −1) + bf (1) + cf ' ( −1) + df ' (1)
that has degree of precision 3.
Sol: 1,1,1/3,−1/3

36. Show that the function f ( x ) = ln( x − 1) + cos( x − 1) has at least one root in the interval
(1.3,2) . By using Newton-Raphson method with initial point 1.3, approximate the positive
root accurates to within 2 decimal places.
Sol: 1.40

37. Use Newton’s method to find solutions accurate to within 10 −5 for the following problems:
(a) Approximate the zero of f ( x ) = − x 3 − cos x . Use the initial point x0 = −0.9 .
2 x cos 2 x − ( x − 2) = 0 for 2 ≤ x ≤ 3 . Use the initial point x0 = 2.5
2
(b)
Sol: −0.8654740; 2.370869.

38. Show that the iteration formula for Newton-Raphson method in solving the equation f(x) =
xm – a = 0 to determine the root m a is of the form
1 a 
xn +1 = ( m − 1) xn + m−1 .
m xn 
Hence, use the iteration formula to solve for 6 , to xn − xn −1 < 10 −2.
Sol: If x0 = 2.5, x2 = 2.4495

39. Obtain the intersection point of y = x − 1 and y = sin(x) by using Newton-Raphson


method with x n − xn −1 < 10 −4 as termination criteria.
Final examination Trimester 2; Session 2000/01, Trimester 2
Sol: If x0 = 2, x3 = 1.934563

Trimester 1, Session 2010/11 6


EEM2036: Numerical Methods Tutorial
−4
40. Use Newton’s method to approximate, to within 10 , the value of x that produces the
point on the graph of y = x 2 that is closest to (1, 0 ) . [ Hint: Minimize [d ( x )] , where d ( x )
2

represents the distance from (x, x 2 ) to (1,0 ) .]


Sol: If x 0 = 0.5 , (0.589755,0.347811)

41. Solve the following


(a) y ′ = 1 + (t − y ) , 2 ≤ t ≤ 3, y (2 ) = 1, with
2
h = 0.5.
( )
(b) 1 + x y ′ − xy = 0 , y(1) = 2,
2
for x = 1.25, 1.50.
dy
(c) = y2 + t2, y (1) = 0, at t = 1.2 with h = 0.1.
dt

by using (i) Euler’s method,


(iii) Runge-Kutta method of order two (Improved Euler’s method),
(iii) Runge-Kutta method of order four.

Sol: (i) 2.000, 2.625, (ii) 1.8125, 2.48155, (iii) 1.8333, 2.5000
(i) 2.25, 2.52439; (ii) 2.262195, 2.546561; (iii) 2.263844, 2.549505
(i) 0.1, 0.222; (ii) 0.111, 0.246836; (iii) 0.1107222, 0.246314

42. Consider the initial value problem


y ′ = − y, y (0 ) = 1.
Approximate y (h ) , where h is the step size, by using
(a) Euler’s method,
(b) Runge-Kutta method of order two, and
(c) Runge-Kutta method of order four.
Leave your answer in terms of h.
Sol: 1− h; 1− h + h2/2; 1−h + h2/2 − h3/6 + h4/24

43. Solve the following linear system.

(a) Perform your calculations in three-digit rounding arithmetic and by using Gaussian
elimination with partial pivoting.
58.9 x1 + 0.03x2 = 59.2
− 6.10 x1 + 5.31x2 = 47.0
Sol: 10.0, 1.00

(b) Perform your calculations in three-digit chopping arithmetic and by using Gaussian
elimination with
(i) partial pivoting,
(ii) scaled partial pivoting.
3.3330 x1 + 15920 x 2 + 10.333 x3 = 7953,
2.2220 x1 + 16.710 x 2 + 9.6120 x3 = 0.965,
− 1.5611x1 + 5.1792 x 2 − 1.6855 x3 = 2.714.
Sol: –9.78, 0.504, 12.0; –1.00, 0.500, 0.993

Trimester 1, Session 2010/11 7


EEM2036: Numerical Methods Tutorial
44. Consider the following linear system, can Jacobi and Gauss-Siedel be used to solve the
problem? Give reasons to your answer.
(a) (b)
3x1 + 6 x2 - x3 = 3, -2 x1 + x2 = 2,
3x1 + x2 + x3 = 7, x1 − 2 x2 + x3 = 4,
2 x1 + 2 x2 + 5 x3 = 8. x 2 − 2 x 3 = 5.
1 2 − 2
(c) Ax = b with A = 1 1 1 .
 
2 2 1 

45. Find the first two iterations of the Jacobi method for the following systems, using x(0) = 0.
If necessary, rearrange the equations to achieve convergence.
10 x1 − x2 = 9,
(a) − x1 + 10 x2 − 2 x3 = 7,
− 2 x2 + 10 x3 = 6.
Sol: x1( 2 ) = 0.97, x2( 2 ) = 0.91, x3( 2 ) = 0.74.
(b) using x(0) = 0.
3x1 + 3x2 + 7 x3 = 4,
3x1 − x2 + x 3 = 1,
3x1 + 6 x2 + 2 x3 = 0.
Sol: x1( 2 ) = 0.1429, x2( 2 ) = −0.3571, x3( 2 ) = 0.4286.
(c) using x(0) = 1.
6 x1 − 3 x 2 + x3 = 11,
2 x1 + x 2 − 8 x3 = −15,
x1 − 7 x 2 + x3 = 10.
Sol: x1(2 ) = 0.886905, x2(2 ) = −0.79762, x3(2 ) = 2.27381.

46. Repeat exercise 45 with Gauss-Siedel method.


( 2)
Sol: (a) x1 = 0.979, x 2( 2 ) = 0.9495, x3( 2 ) = 0.7899.
(b) x1( 2 ) = 0.1111, x2( 2 ) = −0.2222, x3( 2 ) = 0.6190.
(c) x1( 2 ) = 0.962798, x2(2 ) = −0.963220 , x3(2 ) = 1.995297.

47. Apply power method to the following, compute the dominant eigenvalue and the respective
approximate eigenvector.

 6 − 3
x 0 = [1 1] .
T
(a)  − 3 − 2; (Terminate after 4 iterations)
 
 3 2 3
(b) 2 6 6; x 0 = [1 1 1]
T
(Terminate after 3 iterations)
 
 3 6 3
Sol: [1 −0.26001] T, 7.553846; [0.501931 1 0.833977] T, 12.04651

Trimester 1, Session 2010/11 8

You might also like