<<

. 52
( 67 .)



>>

w( x) [ ( a0 + a1 x + · · · + an xn ) ’f ( x) ] dx = 0 for all w.
0
Now, suppose that w is also a polynomial of the order n:
w( x) = b0 + b1 x + · · · + bn xn .
This may also be written in an alternative format:
w( x) = bT p ,
∼ ∼
257 Exercises

with
⎡ ¤ ⎡ ¤
b0 1
⎢ ⎥ ⎢ ⎥
b1 x
⎢ ⎥ ⎢ ⎥
b=⎢ p=⎢
⎥, ⎥.
. .
⎣ ¦ ⎣ ¦
∼ . .

. .
xn
bn

Likewise h( x) can be written as

h( x) = aT p ,
∼ ∼

with
⎡ ¤
a0
⎢ ⎥
a1
⎢ ⎥
a=⎢ ⎥.
.
⎣ ¦
∼ .
.
an

Use of these expressions yields
1
w( x) [h( x) ’f ( x) ] dx
0
1 1
= b pp a dx ’ bT p f ( x) dx = 0.
T T
∼ ∼ ∼
∼∼ ∼
0 0

Notice that both a and b are arrays with polynomial coef¬cients indepen-
∼ ∼
dent of x, while p is an array with known functions of the coordinate x.

Therefore, this equation may also be written as
1 1
pp dx a = b
T T T
b p f ( x) dx .
∼ ∼ ∼
∼∼ ∼
0 0

The integral expression on the left-hand side is a matrix:
1
K= ppT dx,
∼∼
0

while the integral on the right-hand side is a column:
1
f= p f ( x) dx.
∼ ∼
0

The equation must be satis¬ed for all b hence, with the use of the above

matrix-array notation it follows that:

K a = f.
∼ ∼
Numerical solution of one-dimensional diffusion equation
258

(a) Suppose that w( x) and h( x) are both ¬rst-order polynomials.
“ Show that in that case
1
1 2
K= .
1 1
2 3
If f ( x) = 3, show that


3
f= .
3

2

“ Compute the coef¬cients of the polynomial h( x) collected in a.

Explain the results. (Hint: it is recommended to use MATLAB
for this purpose.)
(b) If w( x) and h( x) are both polynomials of the order n, show that
⎡ ¤
· · · n+1
1 1
1 2
⎢1 ⎥
⎢2 · · · n+2 ⎥
1 1
⎢ ⎥
3
K=⎢ . . ⎥.
. .
⎢. .⎥
. .
⎣. .¦
. .
· · · 2n+1
1 1 1
n+1 n+2
(c) Let f ( x) be such that
f ( x) = 1 for 0 ¤ x ¤ 0.5,
f ( x) = 0 for 0.5 < x ¤ 1.
“ Show that in this case
⎡ ¤
1
2
⎢ ⎥
⎢ ⎥
1 12
1
2( 2)
p f ( x) dx = ⎢ ⎥.
f= ⎢ ⎥
.
.
∼ ∼
⎣ ¦
.
0
1 1 n+1
n+1 ( 2 )
“ Use MATLAB to ¬nd the polynomial approximation h( x) of f ( x)
for n = 2, n = 3, etc. up to n = 10. Plot the original function
f ( x) as well as the polynomial approximation h( x). Hint: use the
function polyval. If the MATLAB array a represents a and n ∼
denotes the order of the polynomial, then to plot the function h( x)
you may use
x=0:0.01:1; plot(x,polyval(a(n+1:-1:1),x))
Investigate the condition number of the matrix K with increasing

n. Hint: use the MATLAB function cond. What does this condi-
tion number mean and what does this imply with respect to the
coef¬cients of h( x), collected in a?

259 Exercises

14.2 Consider the differential equation
du d du
u+ + + f = 0,
c
dx dx dx
on the domain a ¤ x ¤ b.
Derive the weak form of this differential equation, and explain what steps
are taken.
14.3 Let f ( x) be a function on the domain 0 ¤ x ¤ 1. Let f ( x) be known at
n points, denoted by xi , homogeneously distributed on the above domain.
Hence the distance x between two subsequent points equals
1
x= .
n’1
A polynomial fh ( x) of order n ’ 1 can be constructed through these points,
which generally will form an approximation of f ( x):

fh ( x) = a0 + a1 x + · · · + an’1 xn’1 .

(a) Show that the coef¬cients of ai can be found by solving
⎡ ¤⎡ ¤⎡ ¤
n’1
1 x1 x1 · · · x1
2 f1
a0
⎢ 1 x x2 · · · xn’1 ⎥ ⎢ a ⎥ ⎢ f ⎥
⎢ ⎥⎢ 1⎥ ⎢2 ⎥
2
⎢ n’1 ⎥ ⎢ ⎥⎢ ⎥
2 2
⎢ 1 x3 x3 · · · x3 ⎥ ⎢ a2 ⎥ = ⎢ f3 ⎥,
2
⎢ ⎥⎢ ⎥⎢ ⎥
⎢. . . ⎥⎢ . ⎥ ⎢ . ⎥
. . . ¦⎣ . ¦ ⎣ .
.. . .
⎣. . ¦
. .
. . .
···
2 n’1 an’1 fn
1 xn xn xn

where fi = f ( xi ).
(b) Use this to ¬nd a polynomial approximation for different values of n
to the function:

f ( x) = 1 for 0 ¤ x ¤ 0.5,
f ( x) = 0 for 0.5 < x ¤ 1.

Compare the results to those obtained using the weighted residuals
formulation in Exercise 14.1(c). Explain the differences.
14.4 Consider the domain ’1 ¤ x ¤ 1. Assume that the function u is known
at x1 = ’1, x2 = 0 and x3 = 1, say u1 , u2 and u3 respectively. The
polynomial approximation of u, denoted by uh is written as

uh = a0 + a1 x + a2 x2 .

(a) Determine the coef¬cients a0 , a1 and a2 to be expressed as a function
of u1 , u2 and u3 .
Numerical solution of one-dimensional diffusion equation
260

(b) If the polynomial uh is written in terms of the shape functions Ni :
n
uh = Ni ( x) ui ,
i=1

then determine Ni , i = 1, 2, 3 as a function of x.
(c) Sketch the shape functions Ni .
(d) Is it possible that the shape function Ni = 1 at x = xi ? Explain.
(e) Is it possible that the shape function Ni = 0 at x = xj with j = i?
Explain.
14.5 Consider the differential equation
d du
=1
c
dx dx
on the domain 0 ¤ x ¤ h1 + h2 . At both ends of this domain u is set to
zero. Consider the element distribution as depicted in the ¬gure below.

u1 u3 u2
©1 ©2


(a) Derive the weak formulation of this problem.
(b) The elements employed have linear shape functions stored in array
N ( x). Express these shape functions in terms of x and the element

lengths h1 and h2 .
(c) Show that the coef¬cient matrix of an element is given by
dN dN T
Ke = ∼
c ∼ dx.
dx dx
e

(d) Demonstrate that the coef¬cient matrix of element e is given by

’1
c 1
Ke = ,
’1 1
he

if c is a constant.

<<

. 52
( 67 .)



>>