MATH 251 Exam 2 Multiple Previouses, Fall 2015
American University of Beirut · Numerical Computing · 136 pages
Showing the first 10 of 136 pages. Download the PDF to see all of it.
More MATH 251 files
Show the text of this exam
AMERICAN UNIVERSITY OF BEIRUT
Faculty of Arts and Sciences
Mathematics Department
MATH 251/CMPS 251
MID TERM EXAMINATION
FALL 2004-2005
Closed Book, One hour 15 minutes
SUBMIT THE QUESTION SHEET WITH BOOKLET
(ONLY SCIENTIFIC CALCULATORS ARE ALLOWED.
PROGRAMMABLE AND GRAPHIC CALCULATORS ARE FORBIDDEN)
STUDENT NAME
ID NUMBER
1
1. Let x ∈ F ≡ F(b, p, emin, emax), with x = ±m × be.
-(5 points) Fill in the bounds on m
.............................. ≤ m ≤ ..............................
and if m2 = succ(m1), both m1 and m2 mantissas in F, find m2 − m1.
m2 − m1 = .................................
-(5 points) Assume b = 2, p = 5, emin = −3, emax = 3. How many positive num-
bers does F includes ? -(10 points)Fill in the missing statements in the following
MATLAB program that generates the non-negative elements of a floating-point system
F(b, p, emin, emax).
function x=float(b,p,emin,emax)
x=0;
epsm=b^(-p+1);
%M represents all possible values taken by the mantissa
M=.................................;
E=1;
for ..............................
x=[x .....................];
E=E...........................;
end
E=...........................................................................:
for ..............................
x=[x ..................];
E=E...........................;
end
-(5 points) How many floating-point operations (additions and multiplications) would
be required to execute the above program.
2
2. Consider the floating-point system F = F( 10, 6, −4, 5). This system uses rounding to
the closest.
(a) Fill in the following table. (10 points)
Values of following parameters in F
xmin
xmax
ϵM (epsilon machine)
Representation of
1
11
succ( 1
11)
(b) (10 points) Convert x = −(652.2025)10 into octal form ? Give then the hexadeci-
mal form of the internal IEEE single precision floating point representation of x,
using rounding to the closest.
Conversion of x = −(652.2025)10
to octal and IEEE hexadecimal form
Corresponding octal form
Corresponding IEEE hexadecimal form
3
3. Consider the function f(x) = e−x − sin(x).
(a) (5 points) How many roots does this function have on (0, 4). Graph this function
on this interval and locate the first root r of f(x).
4
(b) (5 points) Find the least number of iterations that provide an approximation to
r within 5 significant figures using the bisection method.
Number of iterations :
IN WHAT FOLLOWS CARRY ALL YOUR COMPUTATIONS WITH AT
LEAST 5 FIGURES
(c) (10 points) Compute the following iterations :
-Give the sequence of 2 approximations obtained by applying 2 iterations of the
bisection method with a = 0, b = 1.
x1 :
x2 :
-Give the iteration function rn = g(rn−1) of Newton’s method :
Then compute the sequence of 2 approximations obtained by applying 2 iterations
of Newton’s method with x0 = 0.5.
x1 :
x2 :
-Give the iteration function rn = g(rn−1, rn−2) of the secant method :
Then give the sequence of 2 approximations obtained by applying 2 iterations
of the secant method with x0 = 1 and x1 = 0.5.
x1 :
x2 :
5
4. Consider finding the cubic root r of a positive number a, r = a1/3. Write Newton’s
process that would yield an approximation to r. Does it converge for any initial choice
of the iteration ? Justify by any argument.
6
AMERICAN UNIVERSITY OF BEIRUT
Faculty of Arts and Sciences
Mathematics Department
MATH-CMPS 251
MID TERM EXAMINATION
FALL 2006-2007
Closed Book, One hour 15 minutes
SUBMIT THE QUESTION SHEET WITH BOOKLET
(ONLY NON-PROGRAMMABLE AND NON-GRAPHIC
CALCULATORS ARE ALLOWED)
STUDENT NAME
ID NUMBER
Problem
Out of
Grade
1
10
2
10
3
15
4
15
TOTAL
50
1
1. Let x ∈ F ≡ F(b, p, emin, emax), with x = ±m × be.
-(4 points) Fill in the missing statements in the following MATLAB pro-
gram that generates the positive elements of a floating-point system
F(b, p, emin, emax).
function x=float(b,p,emin,emax)
x=[];
epsm=b^(-p+1);
%M represents all possible values taken by the mantissa
M=.................................;
E=b^emin;
for ..............................
x=[x M*E];
E=E*.........;
end
-(3 points) How many floating-point operations (additions and multi-
plications) would be required to execute the above program.
-(3 points) Find the cardinality of F if F = F(7, 6, −4, 4)
2
2. Consider the floating-point system F = F( 10, 7, −6, 7). This system
uses rounding to the closest.
(a) (4 points) Fill in the following table.
Values of following parameters and elements in IEEE single precision system
xmin
xmax
ϵM (epsilon machine)
Representation of
1
13
succ( 1
13)
(b) (6 points) Convert x = (653.325)10 into octal form? Give then the
hexadecimal form of the internal IEEE single precision floating
point representation of x, using rounding to the closest.
Conversion of x = (653.325)10
to octal and IEEE hexadecimal form
Corresponding octal form
Corresponding IEEE hexadecimal form
3
3. Consider the function f(x) = e−x − 4x(1 − x).
(a) (3 points) Show graphically that this function has only 2 distinct
roots on (−∞, ∞). Locate these roots.
4
(b) (3 points) Find the least number of iterations that provide an ap-
proximation to r within 6 significant figures using the bisection
method.
Number of iterations:
-Apply the bisection method twice to find approximations to EACH
of the two rooots.
Approximation to first root :
Approximation to second root:
(c) (4 points) Let f(x) = a − 1
x, a > 0
-Write the Newton iteration to find the root r of f(x).
-Give the interval (α, β) such that when x0 ∈ (α, β) the iteration
converges. Justify your answer.
5
(d) (5 points) Prove that the Newton sequence {xn} verify:
��xn − 1
a
�� = an ��x0 − 1
a
��2n
-Assume that 1 ≤ a < 2 and |x0 − 1
a| ≤ 1
2. How many iterations
are needed to get 1
a within 6 significant figures.
6
4. Consider the system of linear equations Ax = b, where A ∈ R4,4, x,
b ∈ R4, given by:
9x1
+
4x2
+
7x3
+
5x4
=
20
2x1
+
7x3
+
8x4
=
9
6x1
+
8x2
+
x3
=
15
4x1
+
5x2
+
4x3
+
3x4
=
12
(a) (10 points) Give the augmented matrix [A|b] of this system, then
solve the given system (i.e. find x1,x2,x3,x4) using Gauss reduc-
tion with scaled partial pivoting followed by backward substi-
tution. Specify all the parameters of the reduction, particularly
the scales, the multipliers and the interchange of rows through
an index vector IV .
Carry out this procedure using whenever
necessary fraction representation of numbers.
7
(...Continued...)
8
(b) (10 points) Find the determinant det(A) of the system matrix A,
then specify the elements of the 4 by 4 matrices L and U, which
verify
B = A(IV, :) = LU
Write out this equality, exbiting the elements of B,L and U.
9
AMERICAN UNIVERSITY OF BEIRUT
Faculty of Arts and Sciences
Mathematics Department
MATH 251
QUIZ II
FALL 2007-2008
Closed Book, 75 MINUTES
WRITE YOUR ANSWERS ON THE QUESTION SHEET
STUDENT NAME
ID NUMBER
Problem
Out of
Grade
1
16
2
14
3
12
4
8
TOTAL
50
1
1. (16 points) Consider the following square matrix:
2
−2
3
7
4
4
0
7
2
1
1
3
6
5
4
17
(a) (9 points) Apply on this matrix, Gauss Elimination with the
scaled partial pivoting strategy, showing the status of the
4 by 4 matrix after each elimination, i.e. each of the pivot rows
and the corresponding multipliers should be identified and circled.
• Reduction 1:
Changing Matrix Coefficients
scales
Including Multipliers
s
2
(continued...)
3
(b) (7 points) Specify the elements of the 4 by 4 matrices P, L and U
which verify:
PA = LU
and give the determinant of the original matrix A
4
2. (14 points) Consider the following n ∗ n quadridiagonal matrix
A =
d1
u1
0
· · ·
· · ·
0
0
0
l1
d2
u2
0
· · ·
· · ·
0
0
v1
l2
d3
u3
0
· · ·
0
0
0
v2
l3
d4
u4
0
· · ·
0
0
0
v3
l4
d5
u5
· · ·
0
...
...
...
...
...
...
...
...
0
0
· · ·
0
vn−3
ln−2
dn−1
un−1
0
0
· · ·
0
0
vn−2
ln−1
dn
This matrix is assumed to have the diagonal dominance property:
|di| ≥ |ui| + |li−1| + |vi−2|, ∀i, 3 ≤ i ≤ n − 1
|d1| ≥ |u1|, |d2| ≥ |u2| + |l1|, |dn| ≥ |ln−1| + |vn−2|
As such we can use naive Gauss elimination to reduce it into an upper
triangular matrix.
(a) (8 points) Complete the following algorithm that should perform
the reduction of the matrix A:
function [d,u,l,v]=lu_QuadriDiag(d,u,l,v)
% d is the diagonal vector. Its dimension is n
% u is the upper diagonal vector. Its dimension is n-1
% l is the first lower diagonal vector. Its dimension is n-1
% v is the second lower diagonal vector. Its dimension is n-2
for k= :
% Get the multipliers (take into consideration the last iteration)
% Modify the coefficients (take into consideration the last iteration)
end
5
(b) (4 points) Give the number of flops needed to execute the above
algorithm.
(c) (2 points) Give the upper triangular matrix U obtained from this
reduction.
6
3. (12 points) Consider a function f(x) given at 6 distinct data points by
the following table:
x
0
0.1
0.2
0.3
0.4
0.5
0.6
f(x)
1.00
1.01
1.02
1.05
1.08
1.13
1.19
(a) (8 points) In case you want to use this table to find an approximate
value to f(x), 0.2 < x < 0.3, give on the basis of Newton’s formula,
the expression of p3(x), the most suitable interpolation polynomial
of degree 3.
(b) (4 points) Compute p3(0.25).
7
4. (8 points) Consider the set:
D3 = {(xi, yi)|i = 1, 2, 3},
where yi = f(xi) for a given function f, (xi ̸= xj, i ̸= j).
x1
x2
x3
y1
y2
y3
Prove that:
[x1, x2, x3] = [xi1, xi2, xi3]
where {i1, i2, i3} is any permutation of {1, 2, 3}.
8
1
AMERICAN UNIVERSITY OF BEIRUT
Faculty of Arts and Sciences
Mathematics Department
MATH 251
Quizz II
Fall 2008 – 2009
Closed Book : 75 minutes
STUDENT NAME: .
ID NUMBER: .
Problem 1……………………/ 22…………
Problem 2……………………/ 23………….
Problem 3……………………/ 5……………
TOTAL / 50
2
I – Consider the following square matrix:
(22 points)
(a) Apply on this matrix Gauss Elimination with scaled partial pivoting procedure,
showing the status of the 3 by 3 matrix after each reduction, i.e each of the pivot
equations should be identified and the corresponding multipliers should be boxed.
Show also the status of the Index Vector at each reduction.
3
(b) Specify the elements of the matrices P, L and U that satisfy the LU- decompostion of
A, then find the determinant of A.
Determinant A =
4
(c) Use the LU decomposition of A to find the second column of A-1: the inverse of A.
5
II . Based on the following set of data D3 representing some function y = f(x)
i
x(i)
y(i)
0
0
1
1
0.5
0
2
1
1
3
1.5
0
(23 points)
(a) Determine the Natural Cubic Spline function S(x), interpolating the set D3.
6
7
(b) Interpolate f(0.4)
(c) Draw an approximate curve representing the graph of S(x), showing the tangents at
all nodes.
8
III – Fill in the missing statements in the following Matlab program.
(5 points)
function p = Neville(X, Y, s)
% Input arguments : a vector X representing the distinct xi data
% : a vector Y representing the corresponding yi = f(xi) data
% : s is a number at which we want to interpolate
% Output arguments : p = p(s), the value of the interpolation polynomial at the X data
% Assume length(X) = length(Y) > 0
% Place the base statement of the recursion
n = length(X);
if n = 1
…………………………………………………………………………………………………………………………………. ;
else
X1 = X(1: n-1) ; Y1 = Y(1: n-1);
X2 = X(2: n) ; Y2 = Y(2: n);
p1 = ……………………………………………………………………………………………………………………………… ;
p2 = ……………………………………………………………………………………………………………………………… ;
p = ……………………………………………………………………………………/………………………………………… ;
end
AMERICAN UNIVERSITY OF BEIRUT
Faculty of Arts and Sciences
Mathematics Department
MATH 251
QUIZ II
FALL 2009-2010
Closed Book, 75 MINUTES
WRITE YOUR ANSWERS ON THE QUESTION SHEET
STUDENT NAME
ID NUMBER
Problem
Out of
Grade
1
16
2
13
3
13
4
8
TOTAL
50
1
1. Consider a function f(x) given at 4 distinct data points by the following
table:
i
xi
yi
0
1.0
0
1
1.5
1.76
2
2.0
3.01
3
3.0
4.77
(a) Use this table to create a lower triangular matrix whose entries
are Neville’s interpolating polynomials of all orders.
Note: Show the details of your calculations in the space left below
i
xi
yi = pi(x)
.......pi,i+1(x).........
......pi,i+1,i+2(x).......
...pi,i+1,i+2,i+3(x)....
0
1.0
0
.
.
.
1
1.5
1.7
.
.
.
2
2.0
3.0
.
.
.
3
3.0
4.7
.
.
.
2
......
3
(b) Approximate f(1.25), using the most suitable Quadratic inter-
polation polynomial .
(c) Based on the EXISTENCE and UNIQUENESS properties of p0123(x),
and using the LEAST number of additional parameters, find a
polynomial that takes the values shown in the given table, and
has at x = 4 the value 5.(Note that p0123(4) = 5.5)
4
2. Determine the Natural Quadratic Spline based on the first 3 nodes of
the Table given in exercise 1.
5
3. MATLAB QUESTION : NAIVE GAUSS
6
4. The objective of this exercise is to set a procedure that finds the LU-
decomposition of AT, as the product of a lower unit triangular ma-
trix L1, and an upper triangular matrix V , based only on the LU-
decomposition of the matrix A itself.
In this view, consider the following LU- decomposition of the matrix A
obtained through the Naive Gaussian elimination procedure
A =
1
1
0
2
4
1
−2
4
2
=
1
0
0
2
1
0
−2
3
1
1
1
0
0
2
1
0
0
−1
= LU
(a) Determine the matrices D and U1 that factor the matrix U as the
product of a diagonal matrix D = Diag(U) and a Unit Upper
triangular matrix U1, where:
U =
1
1
0
0
2
1
0
0
−1
=
.
0
0
0
.
0
0
0
.
1
.
.
0
1
.
0
0
1
= DU1
(b) Determine then, the lower triangular matrix M that factors A as
A = MU1.
M =
.
0
0
.
.
0
.
.
.
Justify the results:
7
(c) Based on the results above, express AT as the product AT = L1V
where L1 is a unit Lower triangular matrix, and V is an upper
triangular matrix.
(Hint: (XY )T = Y TXT)
L1 =
1
0
0
.
1
0
.
.
1
V =
.
.
.
0
.
.
0
0
.
Justify the results:
(d) Identify (DO NOT CALCULATE ) the multipliers used at
each reduction if the Naive Gauss elimination were applied on the
matrix AT.
• Multipliers of Reduction 1:
• Multipliers of Reduction 2:
8
AMERICAN UNIVERSITY OF BEIRUT
Mathematics Department-FAS
MATH 251
FALL 2010-2011
Quiz 2
Closed Book, 75 mn
STUDENT NAME
ID NUMBER
Problem
Out of
Grade
1
15
2
20
4
15
TOTAL
50
1
1. (15 points) Let A be the following 4 × 4 matrix:
2
1
−1
1
1
1
0
3
−1
2
3
−1
3
−1
−1
2
(a) (8 points) Apply on this matrix, Gauss Elimination with the
scaled partial pivoting strategy, showing the status of the
matrix after each elimination, i.e. each of the pivot rows and the
corresponding multipliers should be identified and circled. Update
the index vector at each reduction.
2
(b) (3 points) Extract the 4 by 4 matrices P, L and U which determine
the LU-factorization of A.
• P=
• L=
• U =
3
(c) (4 points) Use the LU - decomposition of A to determine the
last column of A−1.
4