CPSC 302 Exercise 3.13 and its solution
Uri Ascher & Chen Greif
January 2014
Question
Write a Matlab program to nd all the roots of a given, twice continuously dierentiable, function
f C 2 [a, b].
You
CPSC 302, Fall, 2014
Assignment 3, due Monday, September 29
Please show all your work: provide a hardcopy of the entire assignment (including
plots and programs); in addition, e-mail your Matlab progr
CPSC 302 Assignment 2 Solution
Uri Ascher
September 2015
Question 1
(a) In the base = 13, we have 12 = 0/130 + (12)/131 + 0. In normalized repre13
12
sentation we write this as 13 = [(12)/130 ] 131 .
CPSC 302 Assignment 1 Solution
Uri Ascher
September 2015
Question 1
(a) Taylor series expansions for h give
h2
f (x0 ) +
2
h2
f (x0 h) = f (x0 ) hf (x0 ) + f (x0 )
2
Subtracting the 2nd expression f
CPSC 302 Assignment 3 Solution
Uri Ascher
October 2014
Question 1
(a) We have x = g(x ) and xk+1 = g(xk ). Let the error be en = xn x for any n. Then
1 00 2
3
0
ek+1 = g(xk ) g(x ) = g(x ) + g (x )ek
CPSC 302, Fall, 2014
Assignment 5, due Friday, October 24
Please show all your work: provide a hardcopy of the entire assignment (including
plots and programs); in addition, e-mail your Matlab program
CPSC 302, Fall Term, 2014
Assignment 4, due Wednesday, October 8
Please show all your work: provide a hardcopy of the entire assignment (including
plots and programs); in addition, e-mail your Matlab
CPSC 302, Fall, 2015
Assignment 1, due Wednesday, September 16
Please show all your work: provide a hardcopy of the entire assignment (including
plots and programs); in addition, e-mail your Matlab pr
CPSC 302, Fall, 2014
Assignment 1, due Wednesday, September 10
Please show all your work: provide a hardcopy of the entire assignment (including
plots and programs); in addition, e-mail your Matlab pr
CPSC 302 Assignment 4 Solution
Uri Ascher
October 2015
Question 1
For the constant vector, ui = , i = 1, 2, . . . , n, with = 0 some nonzero constant,
we obviously have that v is a vector of n 1 zeros
CPSC 302 Assignment 8 Solution
Uri Ascher
November 2014
Question 1
Note that n = 40 here replaces n = 32 in Examples 8.2 and 8.4 in the text.
(a) function lam=PowerMethod(A,tol);
[n n]=size(A);
x=rand
CPSC 302 Assignment 4 Solution
Uri Ascher
October 2014
Question 1
(
)
(
)
a b
d b
1
1
(a) The inverse of a 2 2 matrix B =
is B = adbe
. Here the
e d
e a
inverse of the rotation matrix G is directly ve
CPSC 302 Assignment 7 Solution
Uri Ascher
November 2015
Question 1
(a) Equating the determinant of A I to 0 we get
(1 )3 3a2 (1 ) + 2a3 = 0.
Let us set = 1. We have to show that the roots of the polyn
CPSC 302, Fall, 2015
Assignment 6, due Monday, November 9
Please show all your work: provide a hardcopy of the entire assignment (including
plots and programs); in addition, e-mail your Matlab program
CPSC 302, Fall, 2014
Assignment 2, due Wednesday, September 17
Please show all your work: provide a hardcopy of the entire assignment (including
plots and programs); in addition, e-mail your Matlab pr
CPSC 302, Fall, 2015
Assignment 2, due Wednesday, September 23
Please show all your work: provide a hardcopy of the entire assignment (including
plots and programs); in addition, e-mail your Matlab pr
CPSC 302, Fall, 2015
Assignment 7, due Friday, November 27
Note: this is our last assignment. It is longer and more involved than the previous
ones. Its grade will correspondingly weigh double.
Please
CS 302
Term I, 2015-2016
3. Nonlinear equations in one variable
Uri M. Ascher
Department of Computer Science
The University of British Columbia
ascher@cs.ubc.ca
https:/www.cs.ubc.ca/cs302/302/
Goals o
CS 302
Term I, 2015-2016
7. Linear systems: Iterative methods
Uri M. Ascher
Department of Computer Science
The University of British Columbia
ascher@cs.ubc.ca
https:/www.cs.ubc.ca/cs302/302/
Goals and
.
.
Chapter 1: Numerical Algorithms
Uri Ascher
UBC Computer Science
Department of Computer Science
University of British Columbia
ascher@cs.ubc.ca
http:/www.cs.ubc.ca/cs302/302/index.html
Uri Ascher (
CPSC 302, Fall, 2014
Assignment 8, due Monday, November 24
Please show all your work: provide a hardcopy of the entire assignment (including
plots and programs); in addition, e-mail your Matlab progra
CPSC 302 Assignment 7 Solution
Uri Ascher
November 2014
Question 1
(a) It is not dicult to show that the eigenvalues of A are 1 + 2a, 1 a
and 1 a. Therefore, A is symmetric positive denite if and only
CPSC 302 Assignment 6 Solution
Uri Ascher
October 2014
Question 1
(a) The script
x = 0:.1:1.3;
y = [0.95,1.01,1.05,0.97,1.0,-0.1,0.02,-0.1,0.01,0.6,0.72,0.79,0.91,1.0];
plot (x,y,o)
gives the data in
CPSC 302, Fall, 2014
Assignment 7, due Friday, November 14
Please show all your work: provide a hardcopy of the entire assignment (including
plots and programs); in addition, e-mail your Matlab progra
CPSC 302, Fall, 2014
Assignment 6, due Friday, October 31
Please show all your work: provide a hardcopy of the entire assignment (including
plots and programs); in addition, e-mail your Matlab program
CPSC 302 Assignment 5 Solution
Uri Ascher
October 2014
Question 1
Here is my Matlab function:
function x = trid (md,ld,ud,b)
%
% Solve Ax = b for a tridiagonal A
% md = diagonal vecotor of A (length n
CPSC 302 Assignment 2 Solution
Uri Ascher
September 2014
Question 1
(a) In the base = 7, with t 2, we have 8 = 1/70 + 1/71 = 1.1 70 . Thus, d0 = 1, d1 = 1,
7
and all other digits are zero, with the ex
CPSC 302 Assignment 1 Solution
Uri Ascher
September 2014
Question 1
(a) Taylor series expansions for h give
f (x0 + h) =
f (x0 h) =
h2
f (x0 ) +
2
h2
f (x0 ) hf (x0 ) + f (x0 )
2
f (x0 ) + hf (x0 )
CPSC 302, Fall, 2015
Assignment 3, due Monday, October 5
Please show all your work: provide a hardcopy of the entire assignment (including
plots and programs); in addition, e-mail your Matlab programs