5710 NM Tutorial 2
5710 NM Tutorial 2
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
4.
0.305034 103
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)
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)
1
9 + x2 3
7.
Tutorial
f (x)
.
f (x )
2 f ( x )
.
.
1
.
4
.
4
7
.
10
.
19
.
.
Sol:
8.
Prove that
n 1
(a)
f ( x ) = f ( x ) f (x ).
[ f ( x )g (x )] = g ( x 1)f ( x ) + f ( x )g ( x )
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.
f ( x ) = 3 x and nodes
Sol:
P2 (0.5) = 1.5
13.
Tutorial
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.
f [, , , ]
f [, , , , ]
.
.
.
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.:
0
0
1
1
2
16
3
63
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
19.
Tutorial
7
166
Sol: degree 2 or higher than 5
20.
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.
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 ;
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.
f (x 2 ) ,
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
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
29.
By using the composite trapezoidal rule and the composite Simpsons rule, approximate
(a)
x 2e x dx with
2
2 intervals
(b)
30.
Suppose that f (0.25) = f (0.75) = . Find if the Composite Trapezoidal rule with n = 2
gives the value 2 for
Sol: 1.5
31.
( 6 ) ( 6 ) , so that the
2n
cos x dx
with an accuracy of 5 10 9 .
32.
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
Tutorial
By using all of the above data and the trapezoidal method, find an approximate value of
2.4
f ( x ) dx .
1.0
Sol: 8.287708
33.
e x dx , with n = 2.
-1
/4
0
(b)
e x dx , with n=3.
34.
35.
1
1
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
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
39.
Sol: If x 0 = 2, x3 = 1.934563
Trimester 1, Session 2009/10
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.
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
43.
(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,
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:
11,
2 x1 + x2 8x 3 = 15,
x1 7 x2 + x3 = 10.
Sol:
46.
47.
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
x 0 = [1 1] .
T
x 0 = [1 1 1]