Docsity

Homework 3 for Numerical Computing | CSCI 4800, Assignments of Computer Science

Toggle sidebar
bg1
Numerical Computing S’09 MATH/CSCI 4800-01
Homework-3
Due in class on Thursday February 12, 2009
Illegible reports will be returned without grading. Show all work. All Matlab scripts, Matlab output and
plots should be printed out and stapled to the report.
1. (a) What is meant by a fixed point of a function g(x)?
(b) How is the problem of finding a fixed point of g(x) related to the problem of finding a zero of
another function f(x)?
(c) Suppose that we wish to develop an iterative scheme to compute the square root of a given positive
number αby solving the equation f(x) = x2−α= 0.Let the iteration be a fixed point iteration
applied to a suitably chosen function g(x).Let α= 5,and consider the following choices for g:
i.
g1(x) = x+5−x2
2.
ii.
g2(x) = 1 + x−
x2
5.
For each of these choices do the following.
i. Check that the fixed-point problem for g(x) is equivalent to the problem of solving f(x)=0.
ii. Determine if the corresponding fiixed-p oint iteration scheme is locally convergent to √5.
What g(x) corresponds to Newton’s method for this problem?
2. Text: Section 1.3, Page 45, Problem 2(c). This problem requires you to first select an appropriate
g(x).Many choices are possible; justify yours.
3. Indicate whether the following statements are true or false; some may require going back and refreshing
some basic concepts from linear algebra. Justify your answers with suitable explanation. (The matrix
Ais assumed to be square in all cases.)
(a) If the rows of a square matrix are linearly dependent, then so are the columns.
(b) For nonsingular Athe number of solutions to the system Ax =bdepends upon b.
(c) If Ais singular, then the system Ax =bhas no solutions for any b.
(d) The system Ax =bmay have exactly two distinct solutions.
(e) Naive Gaussian elimination (no pivoting) for the system Ax =bfails only when Ais singular.
4. In the class we developed a pseudocode for the solution of an upper triangular system Ux =c
by backward substitution. The corresponding code segment also appears in the file GaussNaive.m
available on line. Write an analogous Matlab code in the form of an m-file for the solution of the lower
triangular system Lx =bof order n. Apply it to solve a lower triangular system of your choice. Be
sure that Lis of order no less than five, and once you have chosen L,select bso that all elements in
the exact solution vector xare unity. Print out L,b,and the exact and computed solution vectors.
Does your code give the correct answer?
5. Consider the linear system Ax =bof order nwhere the elements of Aand bare given by
ai,j = (i+ 1)(j−1), bi=(i+ 1)n−1
i.
(The above choice of bensures that all elements in the exact solution are unity.) Write a Matlab
program GaussMain.m which calls the program GaussNaive.m, available on line, to solve the above
pf2

Partial preview of the text

Download Homework 3 for Numerical Computing | CSCI 4800 and more Assignments Computer Science in PDF only on Docsity!

Numerical Computing S’09 MATH/CSCI 4800- Homework-

Due in class on Thursday February 12, 2009

Illegible reports will be returned without grading. Show all work. All Matlab scripts, Matlab output and plots should be printed out and stapled to the report.

  1. (a) What is meant by a fixed point of a function g(x)? (b) How is the problem of finding a fixed point of g(x) related to the problem of finding a zero of another function f (x)? (c) Suppose that we wish to develop an iterative scheme to compute the square root of a given positive number α by solving the equation f (x) = x^2 − α = 0. Let the iteration be a fixed point iteration applied to a suitably chosen function g(x). Let α = 5, and consider the following choices for g : i. g 1 (x) = x +

5 − x^2 2

ii. g 2 (x) = 1 + x −

x^2 5

For each of these choices do the following. i. Check that the fixed-point problem for g(x) is equivalent to the problem of solving f (x) = 0. ii. Determine if the corresponding fiixed-point iteration scheme is locally convergent to

What g(x) corresponds to Newton’s method for this problem?

  1. Text: Section 1.3, Page 45, Problem 2(c). This problem requires you to first select an appropriate g(x). Many choices are possible; justify yours.
  2. Indicate whether the following statements are true or false; some may require going back and refreshing some basic concepts from linear algebra. Justify your answers with suitable explanation. (The matrix A is assumed to be square in all cases.)

(a) If the rows of a square matrix are linearly dependent, then so are the columns. (b) For nonsingular A the number of solutions to the system Ax = b depends upon b. (c) If A is singular, then the system Ax = b has no solutions for any b. (d) The system Ax = b may have exactly two distinct solutions. (e) Naive Gaussian elimination (no pivoting) for the system Ax = b fails only when A is singular.

  1. In the class we developed a pseudocode for the solution of an upper triangular system Ux = c by backward substitution. The corresponding code segment also appears in the file GaussNaive.m available on line. Write an analogous Matlab code in the form of an m-file for the solution of the lower triangular system Lx = b of order n. Apply it to solve a lower triangular system of your choice. Be sure that L is of order no less than five, and once you have chosen L, select b so that all elements in the exact solution vector x are unity. Print out L, b, and the exact and computed solution vectors. Does your code give the correct answer?
  2. Consider the linear system Ax = b of order n where the elements of A and b are given by

ai,j = (i + 1)(j−1), bi =

(i + 1)n^ − 1 i

(The above choice of b ensures that all elements in the exact solution are unity.) Write a Matlab program GaussMain.m which calls the program GaussNaive.m, available on line, to solve the above

system for n = 12, 13 and 14. For each choice of n, print out the matrices A and b, the computed solution x, the residual r = b − Ax, and kappa, the condition number of A. (The Matlab command for computing the condition number of A is cond(A).) You may need to modify GaussNaive.m so that it does not print out any other quantities.

Comment on, and offer explanation for, the behavior that you observe.