function x = lsq_qr(epsilon)
% set A and b, initialize x
A = [1 1 1;epsilon 0 0;0 epsilon 0;0 0 epsilon];
b = [1;0;0;0];
x = zeros(3,1);
[m,n] = size(A);
% QR fatorization using function house()
[W, R] = house(A);
% compute Q\
Q = eye(4);
temp = zeros(4);
Lecture 19: Steepest Descent Method
Motivation: quasi-Newtons methods, e.g., Broydens method, can achieve superlinear convergence
but depends on the initial guess. We will consider a method which is less sensitive for the initial guess.
Given F : Rn ! Rn
Lecture 20: Homotopy and Continuation Methods
1
Homotopy
Assume that x(0) is an initial estimate of the solution of F (x ) = 0. Define G : [0, 1] Rn ! Rn by
G( , x) = F (x) + (1
)[F (x)
F (x(0)] = F (x) + (
If
= 0, then G(0, x) = F (x)
If
= 1, then G(1,
Math 151B
Winter 2017
Homework 1
Submit the homework in the discussion class, on Tuesday, Jan 24th.
1
Part I (50%)
This part is required to be submitted in class.
(1) Exercise 5.1.1.a
(2) Exercise 5.1.3:b,d
(3) Exercise 5.1.6
(4) Exercise 5.1.7
2
Part II
Name: Yingjie Qi
ID: 304671980
Math-151B
Assignment 1
"
1. (a) ! = ! cos ' , 0 t 1, y 0 = 1
Holding t constant and applying the Mean Value Theorem to the function f (t, y) = ! cos '
We find that when !2 < !4 , a number in !2 !4 exists with
6 ', !4 6(',
Math 151B
Winter 2017
Homework 4
Due: Tuesday, March 7.
1
Part I (50%)
This part is required to be submitted in class.
2
(1) Let F : Rn Rn and g(~x) = kF (~x)k2 . Show that
g(~x) = 2J(~x)T F (~x),
where J(~x) is the Jacobian matrix of F (~x). In particula
Name: Yingjie Qi
ID: 304671980
Math-151B
Assignment 1
'
1. (a) y = y cos t , 0 t 1, y ( 0 )=1
Holding t constant and applying the Mean Value Theorem to the function f (t , y)= y cos t
We find that when y 1< y 2 , a number in y 1 y 2 exists with
f ( t , y
Math 151B
Winter 2017
Homework 2
Due: Tuesday, Feb 7th.
1
Part I (50%)
(1) Show that the Modified Euler method (p.286) is of order two.
(2) Use Theorem 5.20 to show that the Runge-Kutta method of order four is consistent.
(3) Exercise 5.10.4 a,b.
(4) Exer
Math 151B
Winter 2017
Homework 5
Due: Thursday, March 16.
1
Part I (50%)
(1) Exercise 9.3.18.a,b.
(2) Exercise 9.4.2.a.
(3) Exercise 9.5.2.a.
(4) Exercise 9.5.9.
(5) Exercise 9.5.14 with m = 5. (Hint: spectral radius (A) = maxi |i | where i are eigenvalue
Part 2:
cfw_
y
y ,0 t 50
K
y ( 0 )= y 0
Given that y 0=1000, r=0.2, K=4000
And the exact solution is given by
y0 K
y (t )=
y 0 + ( K y 0 ) ert
y
y
Let f (t , y)=r 1
K
Using the Eulers method,
wi+ 1=w 0+ h f ( t i , y i ) , for each i=0,1, , N1
w 0= y 0
(
Yingjie Qi
304671980
Math-151B
Assignment3
1. The local truncation error term is given by part (a)
i +1 ( h ) =
h2
y ' ' ' ( i)
3
By the definition of consistent,
2
h
max y ' ' ' ( i )
0 i N 2 3
max i+1 ( h )=lim
0 i N2
h 0
lim
h 0
2
max h =0
0 i N2
1
Math 151B
Winter 2017
Homework 3
Due: Tuesday, Feb 21.
Part I (50%)
This part is required to be submitted in class.
(1) Exercise 5.10.4.d
(2) Exercise 5.10.7
(3) Exercise 5.11.10
(4) Exercise 5.11.11
(5) Show that the backward Euler (implicit Euler) metho
Part 2:
cfw_
y
y (t )=1+ , 1 t 2
t
(
)
y 1 =2
And the exact solution y (t )=tln ( t ) +2 t
(a) Using Taylors method of order two
2
h
w i+1=wi +hf ( t i , w i ) + f ' ( t i , wi )
2
For h = 0.2
ti
i
0
1.0
1
1.2
2
1.4
3
1.6
4
1.8
5
2.0
For h=0.1
i
0
1
2
3
4
Yingjie Qi
304671980
Math-151B
Assignment 4
n
2
n
Let F : R R g ( x ) =F ( x )2
(1)
t
F( x )=( f 1 ( x ) , f 2 ( x ) , , f n ( x ) )
g ( x ) =f 1 ( x )2 +f 2 ( x )2 + ,+ f n ( x )2
[
f1
( x)
x1
J ( x )=
f n
( x)
x1
f1
(x )
xn
fn
(x )
xn
]
Thus,
[
f1
Part 2:
The following IVP
y' ( t ) =20 y +20 t 2+ 2t , 0 t 1
1
y (0)=
3
with the exact solution
1
y (t )=t 2 + e20t
3
(a) Eulers method
For h=0.2
ti
i
0
0
1
0.2
2
0.4
3
0.6
4
0.8
5
1.0
cfw_
For h=0.125
i
0
1
2
3
4
5
6
7
8
ti
0
0.125
0.250
0.375
0.500
0.62
Lecture 18: Quasi-Newton Methods - Broydens Method
Drawback of Newtons method is that n2 partial derivatives of F (x) are required to compute and
evaluate, which is inconvenient in practice. To approximate the Jacobian matrix, one option is to
apply the f
Lecture 23: Householders Method
1
Householder Transformations
Definition 1. Let w
~ 2 Rn with kwk
~ 2 = 1. The matrix
2w
~w
~T
P = In
is called a Householder matrix. The linear transformation ~x 7! P ~x is Householder transformation.
Remark: If ~0 6= w
~
function x = lsq_normaleq(epsilon)
% set A and b, initialize x
A = [1 1 1;epsilon 0 0;0 epsilon 0;0 0 epsilon];
b = [1;0;0;0];
x = zeros(3,1);
% compute Cholesky A'*A = L*L'
L = chol(A'*A,'lower');
% solve L*delta = A'*y using backward substitution
delta
function [W, R] = house(A)
% setting up and initialize
[m,n] = size(A);
W = zeros(m,n);
% compute QR factoriztion using householder reflector
for k = 1 : n
x = A(k:m, k);
W(k:m,k) = -sign(x(1) * norm(x) * eye(m-k+1,1) - x;
W(k:m,k) = W(k:m,k) / norm( W(k:
MATH 151B Applied Numerical Methods, Winter 2017, Homework 3
Due Friday, February 10, 11:00am
Question 1: (10 marks) Consider the following IVP:
d2 y
dy
= 0.
4y(t) = 6 exp(t), y(0) = 0,
dt2
dt t=0
(a) Obtain the coefficients a and b in the one-step impl
MATH 151B Applied Numerical Methods, Winter 2017,
Homework 5
Due Friday, February 24, 11:00am
Question 1: For the system of equations
x21 + x2 37 = 0
x1 x22 5 = 0
x1 + x2 + x3 3 = 0.
do one step of Newtons Method by hand with a starting value of (1, 1, 1)
PRACTICE PROBLEMS FOR FINAL
1. Initial Value Problems
(1) Give conditions for well-posedness
(2) Are the following problems well-posed?
(a) y 0 = y t2 + 1, with t [0, 2],
(b) y 0 = et+y , with t [0, 1],
y0 = 0
y0 = 1
(3) Come up with sample problems that
Math 151B
Winter 2017
Homework 2
Due: May 4th.
1
Part I (50%)
(1) Show that the Modified Euler method is of order two.
(2) Use Theorem 5.20 to show that the Runge-Kutta method of order four is consistent.
(3) Exercise 5.10.4 a,b,c,d
(4) Exercise 5.4.30.
(
Math 151B
Spring 2017
Homework 1
The due day is Thursday, April 20th.
1
Part I (50%)
This part is required to be submitted in class.
(1) Exercise 5.1.1.a
(2) Exercise 5.1.3:b,d
(3) Exercise 5.1.6
(4) Exercise 5.1.7
2
Part II (50%)
Population growth is des
Math 151B
Homework 3
Tong Mu
UID:704 450 302
1
Part I
5.10.7
Investigate the stability for the difference method
wi+1 = 4wi + 5wi1 + 2h[f (ti , wi )],
for i = 1, 2, ., N 1, with starting values w0 , w1 .
Solution:
Since for a difference method,
wi+1 = w1
Lecture 16: Finite-Dierence Methods for Nonlinear BVP
1
Finite-Dierence Method for nonlinear BVP
Given a nonlinear BVP
(
y 00 = f (x, y, y 0 ),
y(a) = ,
y(b) =
a x b,
we consider finite-dierence method to solve it. To ensure the existence and uniqueness o
Yingjie Qi
304671980
Math-151B
Assignment 2
1. Modified Euler Method
w0 =
f ( t i , wi ) + f ( t i +1 , w i+ hf ( t i , wi ) ] , for i=0,1, N 1
h
wi +1=w i+
2
1
Then, rewrite the second equation w i+1=wi + ( K 1 + K 2 )
2
t
w( i)
where t , K =hf (t +h ,