0% found this document useful (0 votes)
235 views8 pages

5710 NM Tutorial 2

This document provides examples and problems related to numerical methods. It covers topics like error analysis, interpolation, numerical differentiation and integration using techniques like Newton's method, Lagrange interpolation, divided differences, trapezoidal rule, and Simpson's rule. Examples include approximating functions and derivatives, constructing interpolation polynomials, estimating integrals, and finding roots of equations.

Uploaded by

Sivanesh Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
235 views8 pages

5710 NM Tutorial 2

This document provides examples and problems related to numerical methods. It covers topics like error analysis, interpolation, numerical differentiation and integration using techniques like Newton's method, Lagrange interpolation, divided differences, trapezoidal rule, and Simpson's rule. Examples include approximating functions and derivatives, constructing interpolation polynomials, estimating integrals, and finding roots of equations.

Uploaded by

Sivanesh Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 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
104 for each value of p .
(a)

(b)

7
Sol:

2.

3.

[2.718010,2.718554]; [1.912740,1.913122];

1 3 3
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.
Sol: 1.26; 0.63477 10 2
Use four-digit chopping arithmetic to calculate 10 + 6e

3
. Compute the relative
62

error with the exact value determined to at least five digits.


Sol: 15. 15;

4.

0.305034 103

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


evaluated at x 0 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 (x 0 ) = f ( x0 + ) .
~
(a) Use the Mean Value Theorem to estimate the absolute error f ( x0 ) f ( x0 ) and the
~
relative error f (x0 ) f (x 0 ) f ( x0 ) , assuming f ( x0 ) 0 .
If = (5 10 6 )x0 and x 0 = 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?
Sol: absolute error: 0.27015 105 ; bound: 0.2701511530 105 ;
relative error: 0 .77870511 10 6 ; bound: 0 .7787062318 10 5 .

5.

Define
2
1 cos ( x )
[
sin ( x) x]
sin ( x2 )
f (x) =
,
g
(
x
)
=
,
h
(
x
)
=
2

.
x2
1 + cos x
x
Show that f ( x ) = g (x ) = h(x ) , if they exists for the x in the question.
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.
2

(a)
(b)

[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

Trimester 1, Session 2009/10

(d)
1

9 + x2 3

EEM2036: Numerical Methods

7.

Tutorial

Compute the missing values in the following table.

f (x)
.

f (x )

2 f ( x )

.
.

1
.
4

.
4

7
.

10
.

19
.

.
Sol:

8.

f ( x ) : 25, 18, 10,6,5,26,66

Prove that
n 1

(a)

f ( x ) = f ( x ) f (x ).

[Final examination; Trimester 1, Session 2000/01]

[ f ( x )g (x )] = g ( x 1)f ( x ) + f ( x )g ( x )

[Final examination; Trimester 1, Session 2000/01]

k =0

(b)
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
f (x)

0
1

1
5

2
31

3
121

4
341
Sol: 781.

10.

Write the Lagrangian interpolating polynomial that passes through each point:
x

f (x)

2.3
2.1

0.5
1.3

2
15

3.1
31

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

12.

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 x0 = 0.8 and x1 = 1.0 , then P1 (0.9) = 1.091014;
Use Lagrange interpolation to approximate
x0 = 0 , x1 = 1and x 2 = 2 .

3 with the function

f ( x ) = 3 x and nodes
Sol:

Trimester 1, Session 2009/10

P2 (0.5) = 1.5

EEM2036: Numerical Methods

13.

Tutorial

Construct a divided-difference table from:


x

f (x)

0.5
1.15

0.2
0.70

0.7
1.48

0.1
0.14

0
0.13
Sol: f[, , , ,]: 1.997354;

14.

Complete the following divided-difference table.


xk
f[]
f [,]
f [, , ]
1
0
341
4
.
.
781
3
.
.
.
1
2
50
11
.
.

f [, , , ]

f [, , , , ]

.
.
.

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
46
5
0
2
f (x)
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)(x2)

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 x 3 in P3 (x ) is 6.
Sol: 4.25

17.

Approximate
formula.:

f (0.75) using the following data and the Newton forward-difference


x
f (x)

0
0

1
1

2
16

3
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
Volume of production
(in millions of units)

February
12

March
13.4

April
11.5

June
12.5

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 2009/10

EEM2036: Numerical Methods

19.

Tutorial

The following data is taken from a polynomial.


x
0
2
3
4
1
6
5
21
38
61
f (x)
What can you say about its degree? Explain your answer.

7
166
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.

22.

The data for question 11 were generated using the function f ( x) = 3xe x . Use the error
formula to find a bound for the error and compare the bound to the actual error.
Sol: Absolute error = 0.672416 102 Error bound = 0.808792 102 .
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: h 2 /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 (x) =

25.

f (0.66) if

e
. Compare the absolute error for the case of h = 0.01 and 0.001.
( x 2)
Sol: 2.521612 Absolute error: 0 .218374 10 3 ;
2.521396. Absolute error: 0 .218352 10 5 ;

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


x
0.0
0.2
0.4

f (x)
0.00 000
0.74 140
1.37 182

f (x)

If the data were taken from f ( x ) = e x 2 x 2 + 3x 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 2009/10

EEM2036: Numerical Methods

Tutorial

Where x1 x0 = x2 x1 = h .

27.

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

f (x)
5.947734
6.423753
6.922009

x
2.0
2.1
2.2
Given that f ( x ) = e

f ( x )

+ x 2 , compute the absolute error and compare with the error bound.
Sol: 4.648998; 4.871375; 5.09372;
Absolute error: 0 .246567 10

0.257038 10

Error bound:

28.

, 0 .124313 10 3 , 0 .250711 10 3

0.128519 103 , 0.257038 103

1
dx by using the trapezoidal rule and Simpsons rule with one
x 1.5
interval. Find a bound for the error for both methods.

Approximate

3.5

3.0

Sol:0.291667;0.6173 10-2 ; 0.287698, 0.342935 10-4

29.

By using the composite trapezoidal rule and the composite Simpsons rule, approximate

(a)

x 2e x dx with
2

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
gives the value 2 for

f ( x ) dx and with n = 4 gives the value 1.75.


1

Sol: 1.5

31.

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

( 6 ) ( 6 ) , so that the
2n

composite Simpsons rule can be used to compute the integral

cos x dx

with an accuracy of 5 10 9 .
32.

[Final examin ation, Trimester 1, Session 2000/01]; Sol: 18

Given that

f (x)
0.4596698
1.365642
2.574033
4.125200
6.059202
9.765846
14.561390

x
1.0
1.2
1.4
1.6
1.8
2.1
2.4
Trimester 1, Session 2009/10

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.


(a)
(c)

e x dx , with n = 2.

-1
/4
0

(b)

e x dx , with n=3.

(cos x )2 dx , with n=4.


Sol: 2.342696, 1.718281, 0.642699

34.

Find the constants c0, c1 and x 1 so that

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 Newtons 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 .
(b)

2
2 x cos 2x (x 2) = 0 for 2 x 3 . Use the initial point x0 = 2.5

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
x n+1 = ( m 1) x n + m1 .
m
xn
Hence, use the iteration formula to solve for

6 , to x n xn1 < 102.


Sol: If x 0 = 2.5, x 2 = 2.4495

39.

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


method with x n x n1 < 10 4 as termination criteria.
Final examination Trimester 2; Session 2000/01, Trimester 2

Sol: If x 0 = 2, x3 = 1.934563
Trimester 1, Session 2009/10

EEM2036: Numerical Methods

Tutorial

40.

Use Newtons method to approximate, to within 104 , 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 )]2 , where d (x )
represents the distance from (x, x 2 ) to (1,0) .]
Sol: If x0 = 0.5 , (0.589755,0.347811)

41.

Solve the following


(a) y = 1 + (t y )2 ,

2 t 3,
y(2) = 1, with
h = 0.5.
(b) (1 + x 2 )y xy = 0 , y(1) = 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)
(iii)
(iii)

Eulers method,
Runge-Kutta method of order two (Improved Eulers method),
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)
Eulers 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 + h 2 /2; 1h + h 2 /2 h 3 /6 + h 4 /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 us ing Gaussian
elimination with
(i) partial pivoting,
(ii) scaled partial pivoting.
3.3330x1 + 15920x2 + 10.333x3 = 7953,

2.2220x1 + 16.710x 2 + 9.6120x3 = 0.965,


1.5611x1 + 5.1792x 2 1.6855x 3 = 2.714.
Sol: 9.78, 0.504, 12.0; 1.00, 0.500, 0.993

Trimester 1, Session 2009/10

EEM2036: Numerical Methods

44.

Tutorial

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,

3 x1 + x2 + x3 = 7 ,
2 x1 + 2 x2 + 5 x3 = 8 .
1 2 2
Ax = b with A = 1 1 1 .

2 2 1

(c)

45.

x1 2 x2 + x 3 = 4,
x2 2 x3 = 5.

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.
10x1 x2
= 9,
(a)

x1 + 10 x2

2 x3 = 7,

2 x2 + 10 x3 = 6.
Sol:

x1( 2 ) = 0.97, x (22 ) = 0.91, x 3(2 ) = 0.74 .

(b) using x(0) = 0.


3x1 + 3x 2 + 7 x3 = 4,
3x1 x2 + x 3 = 1,
3x1 + 6 x2 + 2 x3 = 0.
Sol:

(c) using x(0) = 1.


6 x1 3 x2 + x3 =

x1( 2) = 0.1429, x2( 2) = 0.3571, x3( 2) = 0.4286.

11,

2 x1 + x2 8x 3 = 15,
x1 7 x2 + x3 = 10.

x1( 2 ) = 0.886905 , x2(2 ) = 0.79762 , x3( 2 ) = 2.27381 .

Sol:

46.

Repeat exercise 45 with Gauss-Siedel method.


Sol: (a) x1( 2 )
(b)
(c)

47.

= 0.979 , x (22 ) = 0.9495 , x (32 ) = 0.7899 .

x1( 2 ) = 0.1111 , x2( 2 ) = 0.2222 , x3( 2 ) = 0.6190 .

x1( 2 ) = 0.962798 , x 2(2 ) = 0.963220 , x3(2 ) = 1.995297 .

Apply power method to the following, compute the dominant eigenvalue and the respective
approximate eigenvector.
(a)

(b)

6 3
3 2;

3
2
3

2 6 6 ;

3 6 3

Trimester 1, Session 2009/10

x 0 = [1 1] .
T

(Terminate after 4 iterations)

x 0 = [1 1 1]

(Terminate after 3 iterations)

Sol: [1 0.26001] T, 7.553846; [0.501931 1 0.833977]T, 12.04651


8

You might also like