Académique Documents
Professionnel Documents
Culture Documents
31
N +1
2
N +1 .
i = 1, , N
(1)
(2)
(3)
i.e.
3
3u2 + 6u1
+ u1 = 1 + 2 ,
2
h
h
6uN 3uN 1
+ uN = 1,
h2
The above equations are collected into the
6
3
0
h2 + 1 h2
6
3
32
h
h2 + 1 h2
A= .
.
..
..
..
.
h32
(4)
(5)
0
1 + h32
~b =
,
.
..
3
h2
.
6
+ 1 N N
1
h2
(b) Explanation 1:
Since the diagonal entries of A is ajj = h62 + 1, and the absolute sum of off-diagonal
entries is |aj1,j | + |aj,j+1 | = | h32 | + | h32 | = h62 < |aj,j |, so A is strictly diagonally
dominant matrix, thus it is invertible (The proof is by contradiction argument). Thus
~u = A1~b is uniquely solvable.
Explanation 2:
We prove that A is monotone. Define r =
A=
3
,
h2
then
2r + 1 r
0
r
2r + 1 r
..
..
..
.
.
.
r
0
0
r
2r + 1
N N
Case 1:vk = v1
(6)
(7)
(r + 1)vk r(vN 1 vk ) 0
(8)
vk 0
(9)
1
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
1.5
2
x
2.5
Figure 1:
c=ones(N,1);
c(1)=1+r;
sol(2:N+1)=A\c;
plot(x,sol,*);
(d) By Lemma 3.1, [1, 1], s.t.
u (x) =
(10)
(11)
h2 (4)
u (xj + j h), j = 1, , N.
4
k~ek kA1 k kf~k
(12)
fj =
(13)
h2 (C + 1)
h2 C + 1
=
;
4 9
36
3
(15)
h2 ~
(U 1) = ~b
36
Since from the numerical results we know u is a decreasing function, so 0 < u(x) < 1
in the interval [1, 3] (or we can compute the exact solution to get this observation),
kA1 k = kA1~k
kA1~bk
h2 ~
1
~
= kA
AU + (U 1) k
36
2
h
~ 1)k
~ + A1 (U
= kU
36
~ k
kU
C
Combine the above two estimates, we have
k~ek
C(C + 1) 2
h .
36
(16)
(17)
N
+1
X
i=1
Span{1 (x), 2 (x), , N +1 (x)}, where i (x), (i > 1) is the linear finite element
with support in (xi1 , xi+1 ) (See lecture notes pp.76). Suppose v(x) V h , then let
v(x) = i (x), for i = 1, , N + 1, we can get the following linear system:
A~u = ~b,
where
aij =
i j dx
2
h
h1
1i=j <N +1
,
i 6= j, |i j| = 1
4
aN +1,N +1 =
1
h
bj =
cos xj dx =
1
1
h (2 cos xj cos xj1 cos xj+1 )
1
h (h sin xN +1 + cos xN +1 cos xN )
1jN
j =N +1
(c) Explanation 1:
~u 6= 0,
~uT A~u
PN +1
N
+1 N
+1
X
X
ui aij uj
i=1 j=1
R2
~uT A~u = 1 v 2 dx
+1
2 N
X
N
+1
X
ui i (x))(
i=1
uj j (x),
0. If ~uT A~u = 0,
v(x) V h , it is only possible for C = 0. Thus A is positive definite, and invertible,
~u = A1~b.
j=1
Explanation 2:
A=
2
1 0
1 2
1
..
..
..
.
.
.
1
0
0
1
1
C2 = cos 1 sin 2.
Use Matlab to solve this problem and compare both solutions in the following:
% Matlab file
N=99;
A=zeros(N+1,N+1);
sol=zeros(N+2,1);
c=zeros(N+1,1);
a=ones(N+1,1)*2;
b=-ones(N,1);
A=diag(a)+diag(b,1)+diag(b,-1);
A(N+1,N+1)=1;
x=[1:1/(N+1):2];
for i=1:N
c(i)=2*cos(x(i+1))-cos(x(i+2))-cos(x(i));
end
c(N+1)=sin(x(N+2))*1/(N+1)+cos(x(N+2))-cos(x(N+1));
sol(2:N+2)=A\c;
plot(x,sol,r*);
hold on
u=cos(x)+sin(2)*x-cos(1)-sin(2);
plot(x,u,b-);
figure;
5
(18)
(19)
plot(x(2:N+2),abs((u(2:N+2)-sol(2:N+2))./u(2:N+2)),*);
f=@(x)cos(x)+sin(2)*x-cos(1)-sin(2);
z = fzero(f,[1.1 2])
The exact and numerical solutions are plotted in the following figure 2. The error is
0.01
u(x)
0.01
0.02
0.03
0.04
0.05
1.2
1.4
1.6
1.8
Figure 2:
u u(x )
defined as e(xj ) = ju(xj ) j , graph the error at each mesh point in figure 3.
It is noted that there is one point which has much larger relative error than other
11
x 10
1.2
1.4
1.6
1.8
Figure 3:
points, this is because it is a zero point(or most close to the zero point) of u(x), to
verify this, run the last two lines of our program, and z = 1.2997.
3. (a) Let e(x) = u(x) uI (x), by the definition of uI (x), over the interval [xj1 , xj ],
e(xj1 ) = e(xj ) = 0. Since u(x) C 2 [1, 2], uI (x) is linear and uI (x) 0, e(x)
C 2 [1, 2]. By mean value theorem, zj [xj1 , xj ], s.t. e (zj ) = 0.
Integration by part,
e (x) e (zj ) =
e (x) =
z
Z xj
e (y)dy
u (y)dy
zj
|e (x)| = |
[x, xj ]
(20)
uI k2a
|u (x)
1
uI (x)|2 dx
N
+1 Z xj
X
j=1
N
+1 Z
X
j=1
2
xj1
xj
xj1
N
+1 Z xj
X
j=1
|u (x) uI (x)|2 dx
xj1
h max1x2 |u (x)|2 (2 1)
ku uI ka hmax1x2 |u (x)|.
Let C = max1x2 |u (x)|, ku uI ka Ch.
By theorem 3.3 in lecture notes pp. 80,
ku uh ka = minvV h ku vka ku uI ka Ch
The second equality is proved.
7
(21)
(22)
u0 = 3.
(b) % Matlab file
N=99;
tau=(5-1)/(N+1);t=[1:tau:5];
u=zeros(N+2,1);u(1)=3;
for i=2:N+2
u(i)=(1+2*tau)*u(i-1)+tau*sin(t(i-1));
end
plot(t,u,*);
8000
7000
6000
5000
4000
3000
2000
1000
0
1.5
2.5
3
t
3.5
4.5
Figure 4:
(c) Let f (t, u) = sin t + 2u, then u (t) = f (t, u). Since u C 2 [1, 5], by Taylor expansion,
u(tm+1 ) = u(tm ) + f (tm , u(tm )) +
2
u (),
2
[tm , tm+1 ]
(23)
= (1 + 2 )em + u ()
2
(24)
(25)
(26)
2
2
C
((1 + 2 )m+1 1)
|em+1 | (1 + 2 )|em | +
i.e.
|em |
(d) Since log(1 + 2 ) 2 , and m =
4m
N +1
|em |
=
Let C =
C 8
4 (e
C
((1 + 2 )m 1)
4
4,
C
((1 + 2 )m 1)
4
C m log(1+2 )
(e
1)
4
C m2
(e
1)
4
C 24
(e 1)
4
C 8
(e 1).
4
(27)