Академический Документы
Профессиональный Документы
Культура Документы
Assignment 1
Fall 2011 Department of Computing Science University of Alberta Due: Friday, October 7 at 23:59:59 local time Worth: 12.5% of nal grade Instructor: Nilanjan Ray, Ath406, nray1@ualberta.ca Note: This assignment is to be submitted electronically by using moodle site (https: //eclass.srv.ualberta.ca/course/view.php?id=337). It needs to be compressed in a single zipped folder. Matlab functions need to be submitted in .m les, such as SolveDiag.m (all of the Matlab functions required are discussed below) so that we can verify them.
to > 1/2. If your function computes a valid solution return flag=0; if divergence is detected return flag=1. Submit the function in a le called SolveGeneralSOR.m.
can be evaluated more accurately in oating-point arithmetic? Why? (b) For what values of x and y, relative to each other, is there a substantial dierence in the accuracy of the two expressions? 4
Computer Problem 1.9. (Page 46) (a) Write a program to compute the exponential function ex using the innite series ex = 1 + x + x 2 x3 + + . 2! 3!
(b) Summing in the natural order, what stopping criterion should you use? (c) Test your program for x = 1, 5, 10, 15, 20, and compare your results with the built-in function exp(x). (d) Can you use the series in this form to get accurate results for x < 0? (Hint: ex = 1/ex .) (e) Can you rearrange the series or regroup the terms in any way to get more accurate results for x < 0?