0% found this document useful (0 votes)
375 views

CSC336 Assignment 2

This document outlines an assignment for a numerical analysis course. It includes 5 questions: 1) Reformulate an expression for the Euclidean norm to avoid overflow and underflow. 2) Write a function to approximate the exponential function using a Taylor series. Test it and analyze errors. 3) Determine if it is possible for one vector to be less than another in the infinity norm. 4) Compute three condition numbers for a given matrix. 5) Prove that scaling a nonsingular matrix by a nonzero scalar does not change its condition number.

Uploaded by

yellowmoog
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
375 views

CSC336 Assignment 2

This document outlines an assignment for a numerical analysis course. It includes 5 questions: 1) Reformulate an expression for the Euclidean norm to avoid overflow and underflow. 2) Write a function to approximate the exponential function using a Taylor series. Test it and analyze errors. 3) Determine if it is possible for one vector to be less than another in the infinity norm. 4) Compute three condition numbers for a given matrix. 5) Prove that scaling a nonsingular matrix by a nonzero scalar does not change its condition number.

Uploaded by

yellowmoog
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

CSC 336F

Assignment #2

Due: 28 October 2011.

This assignment is due at the start of your lecture/tutorial on Friday, 28 October 2011. 1. [5 marks] The Euclidean norm (also called the 2-norm) of a real n-vector x is dened by
n

=
i=1

x2 . i

(1)

How can you reformulate the expression on the right side of (1) to avoid overow and harmful underow in this computation? Justify your answer. 2. [15 marks: 5 marks for each part] (a) Write a MatLab function exp1 to approximate ex by summing the series 1+x+ x2 x3 x4 x5 + + + 2! 3! 4! 5!

from left to right until the accumulated sum stops changing. Test your program by computing exp1(x) for x = 25, 24, 23, . . . , +25 (i.e., x = 25 : +25 in MatLab). For each value of x, compute the relative error exp1(x) exp(x) exp(x) where exp(x) is the MatLab function that approximates ex . For the purpose of this question, assume exp(x) = ex . Format your output neatly. (b) For what values of x does your function produce accurate approximations to ex and for what values of x does your function produce poor approximations to ex ? Explain why your function performs well in the cases where it produces accurate approximations to ex and also explain why your function performs poorly in the cases where it produces poor approximations to ex . Dont just say that it performs poorly because there is rounding error. There is rounding error in your computations for all values of x (except possibly x = 0). However, in some cases, the rounding errors are insignicant and you obtain a good approximation to ex , while, in other cases, the rounding errors are signicant and you obtain a poor approximation to ex . Explain why. Page 1 of 2 pages.

(c) Make a small change to your function exp1 so that it produces accurate approximations to ex for all x = 25, 24, 23, . . . , +25. Call your new function exp2. For each value of x, compute the relative error exp2(x) exp(x) exp(x) where exp(x) is the MatLab function that approximates ex . Format your output neatly. Hint: note ex = 1/ex . 3. [5 marks] Assume x and y are vectors in R2 . Is it possible to have x If so, give an example. If not, explain why not. 4. [7 marks] Consider the matrix A= 5 2 1 2 .
1

> y

and x

< y

Compute cond1 (A), cond2 (A) and cond (A). Show all your calculations. 5. [5 marks] Let A be an n n nonsingular real matrix and let be a nonzero real number. Show that cond(A) = cond(A) That is, scaling a nonsingular real matrix by a nonzero real number does not aect its condition number.

Page 2 of 2 pages.

You might also like