This preview shows pages 1–2. Sign up to view the full content.
Fall 2011, CMPSC/MATH 451
Homework Assignment #1
Due
September 9
(hand over in class or submit via Angel by 11 am)
1
The Euclidean norm of an
n
dimensional vector
x
is deﬁned by

x

2
= (Σ
n
i
=1
x
2
i
)
1
/
2
.
(
a
) Discuss how there may be overﬂow and harmful underﬂow in this computation when using
ﬂoatingpoint arithmetic.
(
b
) Write two functions for computing the norm, a straightforward one (square each element of vec
tor, accumulate partial sum using a loop), and a robust function (how would you avoid/reduce
overﬂow and underﬂow errors in this case? Recall what we had seen in class about associativity
of ﬂoatingpoint addition).
(
c
) Devise an input vector (say, with 5 elements) that produces signiﬁcantly diﬀerent results using
these two routines. Compare with the output using MATLAB/Octave’s
norm
function. List
the MATLAB/Octave code, the test input vector, as well as the output on executing the
functions with these inputs.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview. Sign up
to
access the rest of the document.
This note was uploaded on 01/19/2012 for the course CMPSC 451 taught by Professor Staff during the Spring '08 term at Pennsylvania State University, University Park.
 Spring '08
 staff

Click to edit the document details