MATH 251 Midterm, Fall 2004
American University of Beirut · Numerical Computing · 6 pages
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