CPSC 302 Assignment 1 Solution
January 28, 2011
1. Using the formula given in the question,
(a) By the denition of the derivative we straightforwardly have that
cos(x + ) cos(x)
= sin x.
h
lim
To show explicitly the error in this approximation, write out
CPSC 302 Assignment 1 Solution
Uri Ascher & Chen Greif
January 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 ) +
h3
f (x0 ) + O(h4 ),
6
h3
f (x0 ) + O(h4
CPSC 302 Assignment 4 Solution
March 3, 2011
Question 1
(AT A)T = AT (AT )T , so it is clearly symmetric.
xT AT Ax = (Ax)T Ax = Ax2 0.
2
(1)
Since A has full rank, Ax = 0 if x = 0, hence
xT AT Ax > 0,
as required.
Let A = QR. Then
AT A = (QR)T QR = RT QT
CPSC 302, Winter Term, 2014
Assignment 1, due Wednesday, January 22
Please show all your work: provide a hardcopy of the entire assignment (including
plots and programs); in addition, e-mail your Matlab programs to [email protected]
When e-mailing yo
CPSC 302, Winter Term, 2014
Assignment 2, due Wednesday, February 5
Please show all your work: provide a hardcopy of the entire assignment (including
plots and programs); in addition, e-mail your Matlab programs to [email protected]
When e-mailing yo
CPSC 302 Assignment 4 Solution
April 4, 2011
Question 1
(a) If A is symmetric positive denite, then we have a Cholesky decomposition
A = LLT .
Then
xA =
xT Ax =
(LT x)T (LT x) = LT x2 .
Hence the axioms of a norm hold in this case too, since 2 denes
a nor
CPSC 302 Assignment 2 Solution
February 11, 2011
Question 1
Let f (x) = xg(x). Then f (a) = ag(a) 0, since a g(a) b. Similarly
f (b) 0. Therefore f (a)f (b) 0 with f dened and continuous on [a, b].
Therefore, by the intermediate value theorem, there exist
CPSC 302
2008W T1
Additional notes on eigenvalues
1
Eigenvalues of functions of matrices
Consider a function f : R R which has a Laurent series around p, i.e., coefficients ci ,
such that
X
f (x) =
ci (p + x)k ,
k=
then we can define the associated matrix
Opportunities: About to Graduate?
Consider graduate studies in the Department of Computer
Science
Many, many research areas: AI, graphics, machine learning,
theory, empirical algorithms, bioinformatics, robotics,
computer vision, natural language, netwo
270
Chapter 6: Optimization
6.4 Optimization in One Dimension
We begin with methods for optimization in one dimension, which is an important
problem in its own right, and will also be a key subproblem in many algorithms for
optimization in higher dimensio
CPSC 302 Assignment 5 Solution
April 5, 2014
Question 1
(a) Let us denote c = 2(h)2 . Since the eigenvalues of the symmetric
positive denite matrix A are known and given in the text, and since
the eigenvalues of A are those of A plus c (so A is also posit
Question 3
q = 3, a = 10
q = 2, a = 0
q = 2, a = 2
q = 3, a = 2
q = 2, a = 10
q = 3, a= 0
Note: for q = 3, a = 0, the number of iterations was too large to display all
values of x and fx along the way
Question 4
MATLAB Program
Question 1
Question 4
I-
H
GEL-l
Lnan
Ell-“II.”
LUSH
HLI'ILI'I
b = randt3.l]
x = randt3,l]
inuD = diangJ.A—l;
Aoff = A — _q_i_a_g_{_:!_i_a_g_m] J:
% Jacobi Method
for i=1:53
xJaeob = iﬂgg_.* {b - ﬂﬂii?“]
end
E Gauss—Seidel Method
for i=1:53
KGB = a
for j=1:length{x]
xlj] = _i_
Chapter 3
Kees van den Doel
Computer Science
University of British Columbia
Nonlinear equations in 1 variable
To solve: f(x) = 0
Exact solution (unknown) written as x*
Called zero or root of f(x)
f(x) can be complicated and take a long
time to evaluate
Mu
double f(double x)
cfw_
double z;
int
sign = (int)0x80000000;
unsigned r,t1,s1,ix1,q1;
int ix0,s0,q,m,t,i;
ix0 = _HI(x);
ix1 = _LO(x);
/* high word of x */
/* low word of x */
/* take care of Inf and NaN */
if(ix0&0x7ff00000)=0x7ff00000) cfw_
return x*x+x
CPSC 302, Winter Term, 2014
Assignment 5, due Wednesday, April 2
Please show all your work: provide a hardcopy of the entire assignment
(including plots and programs); in addition, e-mail your Matlab programs
to [email protected] When e-mailing your
Solution of Practice Questions, CPSC 302, Spring 2014
1. (a) A semicolon between elements of a matrix separates rows: it marks
the end of a row of the matrix.
(b) Because zeros are not stored in sparse matrix format, just nonzero
values and their associat
Practice Questions for the nal exam, CPSC 302, Spring 2014
1. (a) What does a semicolon between elements of a matrix in Matlab
signify?
(b) Why does a large sparse matrix that is represented using Matlabs sparse matrix features consume less memory than th
Final Exam Solution, CPSC 302, FALL 2011
Question 1
a) Bisection is preferred when f is not dieretiable, only continuous. Newton is preferred when f is smooth and its derivative is not complicated
to evaluate. Secant is preferred when f is dierentiable bu
Final Exam, CPSC 302, FALL 2011
Dec. 12, 2011
Instructions :
Write down your name and student number in the designated spot in
the booklet.
Make sure this exam has 4 pages.
1
Time: 2 2 hours.
There is choice: answer only ve of the six questions. If yo
CPSC 302 Assignment 4 Solution
Uri Ascher & Chen Greif
March 2014
Question 1
(a)
x = 0:.1:1;
y = [0.9,1.01,1.05,0.97,0.98,0.95,0.01,-0.1,0.02,-0.1,0.0];
plot (x,y,o)
This gives the data in blue circles in the left plot of Figure 1. Based on this we
place
CPSC 302, Winter Term, 2014
Assignment 4, due Wednesday, March 19
Please show all your work: provide a hardcopy of the entire assignment (including
plots and programs); in addition, e-mail your Matlab programs to [email protected]
When e-mailing your
CPSC 302, Winter Term, 2014
Assignment 3, due Wednesday, February 26
Please show all your work: provide a hardcopy of the entire assignment (including
plots and programs); in addition, e-mail your Matlab programs to [email protected]
When e-mailing y
CPSC 302 Assignment 3 Solution
Uri Ascher & Chen Greif
February 2014
Question 1
By denition, A
1
= max
m
A
1
=
x
n
1 =1
m
n
n
aij xj max
max
x
Ax 1 . So,
1 =1
i=1
x
j=1
1 =1
|aij |xj | = max
x
i=1 j=1
1 =1
m
|xj |
j=1
m
|aij | max
i=1
1jn
|aij |.
i=1
To s