Ahinf Norm Proof
Ahinf Norm Proof
Ahinf Norm Proof
1. (3.1-Trefethen & Bau) Prove that if W is an arbitrary nonsingular matrix, the function k kW
defined by kxkW = kW xk is a vector norm.
ANS: We need to show
Note we divided by kxk =6 0 since x is and e-vector, so we must have x 6= 0. Thus || kAk,
and taking the sup over all on the left-handside (in fact a max since their are only a finite
number of e-values), and noting the the right-handside is independent of gives the result.
3. (3.3-Trefethen & Bau) Vector and matrix p-norms are related by various inequalities, often
involving the dimensions m or n. For each of the following, verify the inequality and give an
example of a nonzero vector or matrix (for general m,n) for which equality is achieved. In this
problem x is a m-vector and A is a m n matrix.
ANS:
2 1/2
(a) kxk = maxi |xi | = maxi (|xi |2 )1/2 ( m
P
i=1 |xi | ) = kxk2 . Equality is achieved for
x = ek , k = 1, . . . , m, where ek is one of the standard basis vectors for Cm .
2 1/2 2 1/2 2 1/2
(b) kxk2 = ( m ( m
P P
i=1 |xi | ) i=1 maxi |xi | ) = (mkxk ) = mkxk . For equality
take x = (1, 1, . . . , 1)T Cm . Then kxk = 1 and kxk2 = m.
(c) We have
kAxk
kAk = sup
x6=0 kxk
kAxk2
sup using (a) in the numerator
x6=0 kxk
kAxk2
sup using (b) in the denominator, and noting x Cn
x6=0 kxk2 / n
= nkAk2
For equality, let A Cmn be the matrix whose first row is all ones, and zeros elsewhere.
Clearly kAk = n. Now, A A is an n n matrix whose entries are all equal to one (check!)
and its rank is 1. So 0 is an e-value of A A of multiplicity n1. What is the remaining e-value?
It is n = n, which is easily seenp to be the case
since x = (1, 1, . . . , 1)T Cnis
a corresponding
e-vector (check!). Thus kAk2 = (A A) = n. So we have kAk = n = n n = nkAk2 .
(d) We have
kAxk2
kAk2 = sup
x6=0 kxk2
mkAxk
sup using (b) in the numerator, and noting Ax Cm
x6=0 kxk2
mkAxk
sup using (a) in the denominator
x6=0 kxk
= mkAk
For equality, let A Cmn be the matrix whose first column is all ones, and zeros elsewhere.
Clearly kAk = 1. Now, A A is an n n diagonal matrix whose entries p are all equal
to zero,
except for the (1,1) entry,
equal to m (check!). Thus, kAk2 = (A A) = m. So
which is
we have kAk2 = m = m 1 = mkAk .
kAxk
4. Prove that given a vector norm kxk, the formula kAk = sup defines a matrix norm for a
x6=0 kxk
square matrix A. Recall, this is referred to as the induced matrix norm.
ANS: Suppose A Cmm . We need to show:
= kAk + kBk.
kAxk ||kAxk
kAk = sup = sup
x6=0 kxk x6=0 kxk
kAxk kAxk
= sup = sup
x6=0 kxk x6=0 kxk
= ||kAk.
X
5. Prove that kAk = max |aij |, the maximum absolute row sum of the matrix A.
i
j
kAxk X X X
So max |aij | for all x 6= 0. Now let k be such that max |aij | = |akj |. If
kxk i
j
i
j j
there is more than one such k choose the minimum. We can then write akj = rj eij for some
real number rj 0 and 0 j < 2. Note |akj | = |rj eij | = |rj ||eij | = |rj | = rj . Define
x Cn by xj = eij for j = 1, . . . , n. Notice that is A were a real matrix then we would have
xj = 1 = ei(0,) . Then k xk = 1 and
X X X X X
| akj xj | = | rj eij eij | = | rj | = rj = |akj |.
j j j j j
Finally,
X
Thus, kAxk = max |aij |, the maximum absolute row sum of A.
i
j
6. Consider the 2-point BVP
(
y + (4x2 + 2)y = 2x(1 + 2x2 )
y(0) = 1, y(1) = 1 + e
2
The exact solution is y(x) = x + ex . Write a MATLAB function M-file to solve the problem
using the 4th order centered compact FD scheme
h2 h2
D+ D 1 ci ui + ci ui = 1 + D+ D fi .
12 12
Use meshsize h = 1/2p , where p is a positive integer. Your code should use your M-files trilu
and trilu solve. For p = 1 : 4, plot the exact solution (y(x) vs. x) and the numerical solution
(ui vs. xi ), including the boundary points. The 4 plots should appear separately in one figure,
with axes labeled and a title for each indicating p. Investigate subplot in MATLAB for how to
have multiple plots in a single figure window. For p = 1 : 20 present a table with the following
data - column 1: h; column 2: kuh yh k ; column 3: kuh yh k /h4 ; column 4: cpu time;
column 5: (cpu time)/m, where h = 1/(m + 1). Discuss the trends in each column. Also,
compare the accuracy for each h with the results of the 2nd order code from HW #1. How do
the computational times compare? Include a copy of your code.
ANS: Writing out the discretization gives
h2 2 h2
(1 c )u
12 i1 i1
+ (2 + 5h6 ci )ui (1 c )u
12 i+1 i+1 (fi1 2fi + fi+1 )
= fi + .
h2 12
Here is the code for the first part of the problem, followed by a listing of the M-file function
bvp solve4. The latter requires the M-files trilu and trilu solve from problem 7 (hw #1).
xx=0:0.01:1;xx=xx;
yy=xx+exp(xx.^2);
c=4.*x.^2+2; f=2*x.*(1+2*x.^2);
clf;
for p=1:4
[x,u]=bvp_solve4(2^p-1,0,1,1,1+exp(1),c,f);
max(abs(u-(x+exp(x.^2))))
subplot(2,2,p),plot(xx,yy,x,u,*),grid
axis(tight),xlabel(x),ylabel(y),title([p=,num2str(p)])
end
function [xv,uv,stime]=bvp_solve4(m,a,b,ya,yb,c,f)
%
h=(b-a)/(m+1);
xv=a:h:b; xv=xv;
fv=zeros(m+2,1);
cv=zeros(m+2,1);
%
x=xv;
cfv=eval(c);
fv=eval(f);
%
% setup tridiagonal matrix and rhs
%
av=(2+(5/6)*h^2*cfv(2:m+1))/(h^2);
bv=zeros(m,1); bv(2:m) =-(1-(h^2/12)*cfv(2:m ))/(h^2); bv(1)=0;
cv=zeros(m,1); cv(1:m-1)=-(1-(h^2/12)*cfv(3:m+1))/(h^2); cv(m)=0;
fv=fv(2:m+1)+(1/12)*(fv(1:m)-2*fv(2:m+1)+fv(3:m+2));
%
% BC adjustment
%
fv(1)=fv(1)+(1-(h^2/12)*cfv(1) )*ya/(h*h);
fv(m)=fv(m)+(1-(h^2/12)*cfv(m+2))*yb/(h*h);
%
% solve tridiagonal system; collect cpu time
%
tic;
[alpha,beta]=trilu(av,bv,cv);
uv=trilu_solve(alpha,beta,cv,fv);
stime=toc;
uv=[ya;uv;yb];
p=1 p=2
3.5 3.5
3 3
2.5 2.5
y
2 2
1.5 1.5
1 1
0 0.5 1 0 0.5 1
x x
p=3 p=4
3.5 3.5
3 3
2.5 2.5
y
2 2
1.5 1.5
1 1
0 0.5 1 0 0.5 1
x x
Next we solve the BVP with m = 2p 1 for p = 1, . . . , 20. Here is the code:
c=4*x.^2+2; f=2*x.*(1+2*x.^2);
clf;
h=zeros(20,1); m=zeros(20,1);
times=zeros(20,1);
err_inf=zeros(20,1);
for p=1:20
[x,u,stime]=bvp_solve4(2^p-1,0,1,1,1+exp(1),c,f);
h(p)=1/(2^p);
m(p)=2^p-1;
times(p)=stime;
y=x+exp(x.^2);
err_inf(p)=max(abs(u-y));
end
format short e
disp( )
disp( h inf_err err/h^4 cputime cputime/m )
disp( ----------------------------------------------------------------)
disp( )
disp([h err_inf err_inf./h.^4 times times./m])
We can see from the err/h4 column that the expected O(h4 ) error is observed until h
3.9062e 3 since err/h4 rapidly approaches a constant. But then we lose accuracy. Why?
Roundoff error begins to dominate, as well as the conditioning of the matrix! Note, however,
that the cputime stills scales linearly with m as evidenced by the cputime/m column.
Comparing with the second order method of HW #1 we see that the cpu timeS for the solvers
are close. However, for moderate p the fourth order solution is clearly superior. For example,
the error is 6.1728e 1 for h = 3.9062e 03, while for the second order method with the same
h the error is 5.4521e 06.
Note: I have only timed the linear solver portion of the code.