ColoState Spring 2016 Math 561 Homework 3

advertisement
ColoState
Spring 2016
Math 561
Homework 3
Due Mon. 02/29/2016
Name:
CSUID:
Problem 1 (20 points) Let Tn be the n × n coefficient matrix obtained from discretizing
the 1-dim Poisson’s equation, i.e.,


2 −1 0 · · · 0
0


 −1 2 −1 · · · 0
0 




Tn =  · · · · · · · · · · · · · · · · · ·  .


 0
0
0 · · · 2 −1 


0
0
0 · · · −1 2
(i) Prove that it is symmetric and positive-definite (SPD).
(ii) Perform Gaussian elimination with partial pivoting (GEPP) so that Tn = Ln Un . Derive
formulas for the entries of Ln , Un .
(iii) Perform Cholesky factorization Tn = Ln L′n . Derive formulas for the entries of Ln .
Let L2 [0, 1] be the linear space of all
∫ 1square integrable functions on [0, 1] equipped with the inner product ⟨f (x), g(x)⟩ =
f (x)g(x)dx. Let Pn =
Problem 2 (20 points)
0
Span{1, x, . . . , xn }. For any f ∈ L2 [0, 1], its projection Pn (f ) onto Pn is defined by
⟨Pn (f ), q(x)⟩ = ⟨f (x), q(x)⟩,
∀q(x) ∈ Pn .
Let f (x) = sin(πx). Use Matlab chol or your own Cholesky code to find the coefficients of
Pn (f ) for n = 2, 4, 8, 16, respectively.
Problem 3 (20 points)





A=



Develop a direct solver for a tridiagonal linear system Ax = b where

d1 c1 0
···
0
0



b1
a1 d2 c2 · · ·
0
0 

 b2 


··· ··· ··· ···
···
··· ,
b=
 ··· .

0
0 · · · an−2 dn−1 cn−1 
bn

0
0
···
···
an−1
dn
Furnish your Matlab code. Use, for example, n = 100, for the matrix in Problem 1 and
x = [sin(iπ/(n + 1))]Ti=1···n to generate b and then test your code.
Problem 4 (20 points)
For the following two-point boundary value problem (BVP)
{ ′′
y (x) − p(x)y ′ − q(x)y = f (x),
y(a) = α, y(b) = β,
where p(x) = 2x, q(x) = x2 + 1, [a, b] = [0, 1]. The exact solution is y(x) = x + sin(πx).
(i) Derive α, β, f (x) accordingly.
(ii) Apply the central finite difference method with a uniform partition to the above BVP
to obtain a linear system. What can you say about the coefficient matrix?
(iii) Run your tridiagonal solver to solve the problem for h = 0.1, 0.05, 0.025, 0.0125. Report
the l∞ norm of the errors at the mesh nodes. Plot your numerical solution and the
exact solution for h = 0.05.
Problem 5 (20 points) Solve the ODE BVP in Problem #4 by Jacobi and Gauss-Seidel
iterative methods for h = 0.1, 0.05, 0.025, 0.0125. You could set the maximal number of
iterations as the size of the linear system and the threshold as 10−6 .
(i) Furnish your code for Jacobi and Gauss-Seidel.
(ii) Tabulate your numerical results such as actual numbers of iterations and the l∞ norm
of the errors for both Jacobi and Gauss-Seidel.
Download