Professional Documents
Culture Documents
𝑑 𝑑𝑢
− (1 + 𝑥) =0
𝑑𝑥 𝑑𝑥
u(0)=0, u(1)=1
and obtain the Ritz coefficients.
𝑑 𝑑𝑢
− [(1 + 𝑥) ] = 0
𝑑𝑥 𝑑𝑥
By multiplying with weight function w and then integrating,
1 𝑑 𝑑𝑢
∫0 𝑤 (− 𝑑𝑥 (1 + 𝑥) 𝑑𝑥 ) 𝑑𝑥=0
∫ 𝑤𝑑𝑣 = 𝑤𝑣 − ∫ 𝑣𝑑𝑤
𝑑𝑢 𝑑𝑢 𝑑𝑢 𝑑𝑤
-w(1+x) ⃒x=1 +w(1+x) ⃒x=0 +∫(1 + 𝑥) =0
𝑑𝑥 𝑑𝑥 𝑑𝑥 𝑑𝑥
Or, =Π2/2[1+1/2+0]
𝛱2
Or, =3
4
1 𝑑Ф1 𝑑Ф2 1 20
B12=∫0 (1 + 𝑥) dx=2Π2∫0 (1 + 𝑥) 𝑐𝑜𝑠𝛱𝑥𝑐𝑜𝑠2𝛱𝑥𝑑𝑥 = 𝐵21=-
𝑑𝑥 𝑑𝑥 9
1 𝑑Ф2 𝑑Ф2 1
B22=∫0 (1 + 𝑥) dx=4Π2∫0 (1 + 𝑥) 𝑐𝑜𝑠2𝛱𝑥𝑐𝑜𝑠2𝛱𝑥𝑑𝑥=3Π2
𝑑𝑥 𝑑𝑥
1 𝑑Ф1 𝑑Ф0 1 𝜋𝑥 1
F1=-∫0 (1 + 𝑥) dx=-𝜋2/2∫0 (1 + 𝑥) 𝑐𝑜𝑠𝜋𝑥𝑐𝑜𝑠( )𝑑𝑥=- (6𝜋 − 10)
𝑑𝑥 𝑑𝑥 2 9
1 𝑑Ф2 𝑑Ф0 1 𝜋𝑥 68 4𝜋
F2=− ∫0 (1 + 𝑥) dx=-𝜋 2 ∫0 (1 + 𝑥) 𝑐𝑜𝑠2𝜋𝑥𝑐𝑜𝑠( )𝑑𝑥=( + )
𝑑𝑥 𝑑𝑥 2 225 15
We obtain
3𝜋2 20 (6𝜋−10)
− 𝑐1 −
[ 4
20
9
] [𝑐 ] = [ 68 9 4𝜋 ]
− 3𝜋 2 2 225
+
15
9
𝜋𝑥
U2(x)=c1sin𝞹x+c22𝞹x+𝑠𝑖𝑛
2
𝜋𝑥
=-0.12407sin𝞹x+0.02919sin2𝞹x+ 𝑠𝑖𝑛 .
2
Problem 2.17: Give a one-parameter Galerkin solution of the equation
−∇ 2u = 1 in Ω (= unit square)
u = 0 on Γ
Solution: For this problem, all of the boundary conditions are of the essential type.
Hence, the difference between the Ritz and Galerkin methods disappears. In both
methods, we must choose φ0 and φ1 such that,
φ0 = 0 , φ1= 0 on Γ (1)
𝑑 2 𝑢1
2
= −𝜋 2 . 𝑐11 𝑠𝑖𝑛 𝜋𝑥. 𝑠𝑖𝑛𝜋𝑦
𝑑𝑥
𝑑 2 𝑢1
= −𝜋 2 . 𝑐11 𝑠𝑖𝑛 𝜋𝑥. 𝑠𝑖𝑛𝜋𝑦
𝑑𝑦 2
R= 2𝜋 2 . 𝑐11 [𝑠𝑖𝑛 𝜋𝑥. 𝑠𝑖𝑛𝜋𝑦]-1
The Galerkin integral yields the result,
𝑑2𝑢 𝑑𝑢
−2𝑢
𝑑𝑥 2
+(𝑑𝑥 )2 =4 for 0<x<1
Subject to the boundary conditions u(0) = 1 and u(1) = 0, and compare it with
the exact solution u0 = 1 – x2. Use (a) the Galerkin method, (b) the least-squares
method .
Solution: We must Choose φ0 such that it satisfies all specified boundary conditions
φ0(0) = 1 , φ0(1) = 0
φi must be selected such that it satisfies the homogeneous forms of all specified boundary
conditions
φi(0)=0, φi(1)=0
The following choice would meet the requirements for, φ0(0) = 1, φ0(1) = 0 is
φ0=1-x
And for, φi(0)=0, φi(1)=0
Let φi=a+bx+cx2
for φi=0, 0=a+b(0)+c(0)
a =0
for i(1)=0
0=a+b+c
0=0+b+c
C=-b
Now putting the values of a,b,c the φi becomes b(x-x2)
Or, φi= x(1-x)
The residual
𝑑2 𝛷 𝑑𝛷1 𝑑𝛷0 2
R= -2c1 (c1 φ1+ φ0) 𝑑𝑥21 + (𝑐11 𝑑𝑥
+ 𝑑𝑥
) -4
=-2[(1-x)+c1(x-x2)](-2c1)+[-1+c1(1 − 2𝑥)]2 − 4
=-3+2c1+(c1)2
(a) The weighted residual statement for the galerkin method is given by,
1
∫ (𝑥 − 𝑥 2 )𝑅𝑑𝑥 = 0
0
1
𝑜𝑟, [−3 + 2𝑐1 + 𝑐1 2 ] = 0
6
Therefore,
𝑐1 = 1.
(b)The least-square tatement is given by,
1
𝑑𝑅
∫ 𝑅𝑑𝑥 = 0
0 𝑑𝑐1
1
Or, ∫0 𝑑(−3 + 2𝑐1 + 𝑐1 2 )/𝑑𝑐1 [-3+2𝑐1+𝑐1 2 ]dx=0
1
Or, ∫0 (2 + 2𝑐1 )(−3 + 2 𝑐1 + 𝑐1 2 =0
Or, 𝑐1=1
Problem 2.19: Consider the differential equation
𝑑2 𝑢
− 𝑑𝑥 2 =cosπx, for 0<x<1
Determine a three-parameter solution, with trigonometric functions, using (a) the Ritz
1 1 3
method, (b) the least-squares method, and (c) collocation at x= 2 , 4 𝑎𝑛𝑑 4 and compare
with the exact solutions:
1)u0 = π-2(cos πx + 2x − 1)
2) u0 = π-2 (cos πx − 1)
3) u0= π-2 cos πx
Solution:
𝑑2 𝑢
− 𝑑𝑥 2 -cosπx=0
1 𝑑2 𝑢
∫0 𝑤(− 𝑑𝑥 2 − 𝑐𝑜𝑠𝜋𝑥)𝑑𝑥 = 0
Or,
1 𝑑2 𝑢
-∫0 𝑤( 𝑑𝑥2 + 𝑐𝑜𝑠𝜋𝑥)𝑑𝑥 = 0
Or,
1 𝑑2 𝑢 1
-[∫0 𝑤( 𝑑𝑥2 )𝑑𝑥 + ∫0 𝑤𝑐𝑜𝑠𝜋𝑥𝑑𝑥] = 0
Or,
𝑑𝑢 1 𝑑𝑢 𝑑𝑤 1
-[w𝑑𝑥 − ∫0 𝑑𝑥 𝑑𝑥
dx+∫0 𝑤𝑐𝑜𝑠𝜋𝑥𝑑𝑥] = 0
or,
1 𝑑𝑢 𝑑𝑤 1 𝑑𝑢
[∫0
𝑑𝑥 𝑑𝑥
dx - ∫0 𝑤𝑐𝑜𝑠𝜋𝑥𝑑𝑥]-w𝑑𝑥 =0
or,
1 𝑑𝑢 𝑑𝑤 1
∫0 𝑑𝑥 𝑑𝑥
dx -∫0 𝑤𝑐𝑜𝑠𝜋𝑥𝑑𝑥]-0=0
B(w,u)=l(w)
1 𝑑𝑢 𝑑𝑤
B(w,u)= ∫0 𝑑𝑥 𝑑𝑥
dx
1
l(w)= ∫0 𝜋𝑐𝑜𝑠𝜋𝑥𝑑𝑥
We use φ0 = 0 and φ0 = siniπx. We obtain,
1 0 𝑖𝑓 𝑗 ≠ 𝑖
Bij=∫0 (𝑖𝜋)2 𝑐𝑜𝑠𝑖𝜋𝑥𝑐𝑜𝑠𝑗𝜋𝑥𝑑𝑥 = { } (1)
(𝑖𝜋)2 𝑖𝑓𝑗 = 𝑖
0, if i is odd
Fj={ 2𝑖 }
, if i is even
𝜋(𝑖 2 −1)
The solution is given by,
4 1
Cj=𝜋3 𝑖(𝑖2 −1) , for i even
𝑑2 𝑈𝑁
R= − − 𝑐𝑜𝑠𝜋𝑥 =∑𝑁 2
𝑗=1 𝑐𝑗 (𝑗𝜋) 𝑠𝑖𝑛𝑗𝜋𝑥 − 𝑐𝑜𝑠𝜋𝑥
𝑑𝑥 2
𝜕𝑅
And 𝜕𝐶𝑖
=(𝑖𝜋)2siniπx (4)
1
∫0 (𝑖𝜋)2 𝑠𝑖𝑛𝑖𝜋𝑥( ∑𝑁 2
𝑗=1 𝑐𝑗 (𝑗𝜋) 𝑠𝑖𝑛𝑗𝜋𝑥 − 𝑐𝑜𝑠𝜋𝑥 )𝑑𝑥
The solution of the Galerkin and least squares methods would be the same as that of the
Ritz method.
For the collocation method, we have
1 𝑗𝜋 𝜋
R(x= 4)= ∑3𝑗=1 𝑐𝑗 (𝑗𝜋)2 𝑠𝑖𝑛 4
– cos 4 = 0
1 1 1
=c1𝜋 2 ( ) + 𝑐2 (2𝜋)2 +c3(3𝜋)2 ( ) −
√2 √2 √2
1 𝑗𝜋 𝜋
R(x= 2)=∑3𝑗=1 𝑐𝑗 (𝑗𝜋)2 𝑠𝑖𝑛 2
– cos 2
=0
=C1𝜋 2 + 𝑐2 0 − 𝑐3 (3𝜋)2
3 3𝑗𝜋 3𝜋
R(x= 4)=∑3𝑗=1 𝑐𝑗 (𝑗𝜋)2 𝑠𝑖𝑛 4
– cos 4
=0
1 1 1
=c1𝜋 2 ( ) + 𝑐2 (2𝜋)2 +c3(3𝜋)2 ( ) + (5)
√2 √2 √2
√2
c1=c3=0 and c2=8𝜋2
𝑑𝑢
Set 2: u(0)= 𝑑𝑥 (1) = 0, for Ritz we use φ0= 0, φ1 = x, φ2 = sinπx and φ3 = sin2πx. This
choice makes the variational solution not vanish at x = 1. For convenience, we denote the
new set by {φ0 = x, φ0 = sinπx, φ2= sin2πx}. For the Ritz method, we need to evaluate only
b0j, j = 0, 1,2 and F0. All other coefficients are the same as in Eqs.(1) and (2). We have,
B00= 1, B01 = B02= 0, F2 = −2/π2
For the weighted-residual methods, the above set of approximation functions is not
admissible, because {φ0 = x, φ1 = sinπx, φ2= sin2πx} does not satisfy the natural boundary
condition, u(0) = du/ dx (1) = 0. We select an alternative set,
UN=∑N
j=1 cj Φj (x)+Φ0 = 0
R=-∑𝑁 2
𝑗=1 𝑐𝑗 (𝑗𝜋) 𝑐𝑜𝑠𝑗𝜋𝑥 – cos𝜋𝑥 And
𝜕𝑅
=−(𝑖𝜋)2 cosiπx (8)
𝜕𝐶𝑖
1
F1= 2, Fi=0, when i ≠ 1 (9)
1
C1= -𝜋2 , ci = 0 when i ≠ 1 (10)
The variational solutions coincides with exact solution
1
U(x)= π2 (cosπx − 1)
Collocation method
1 𝑗𝜋 𝜋
R(x= 4)=− ∑3𝑗=1 𝑐𝑗 (𝑗𝜋)2 𝑐𝑜𝑠 - cos 4 = 0
4
1 1 1
=-c1𝜋 2 ( ) − 𝑐2 0+c3(3𝜋)2 ( ) −
√2 √2 √2
1 𝑗𝜋 𝜋
R(x=2)=− ∑3𝑗=1 𝑐𝑗 (𝑗𝜋)2 𝑐𝑜𝑠 - cos 2 = 0
2
=-c10+c2(2π)2-c30-0
3 3𝑗𝜋 3𝜋
R(x= 4)=− ∑3𝑗=1 𝑐𝑗 (𝑗𝜋)2 𝑐𝑜𝑠 - cos 4 = 0
4
1 1 1
=c1𝜋 2 ( ) − 𝑐2 0+c3(3𝜋)2 ( ) + (10)
√2 √2 √2
1
C1= -𝜋2 and c2=c3=0
Set 3:
𝑑𝑢 𝑑𝑢
(0)= 𝑑𝑥 (1)=0
𝑑𝑥
UN=∑𝑁
𝑗=1 𝑐𝑗 𝛷𝑗 (x)+𝞥0=0
𝞥0=0, 𝞥j(x)=cosjπx (1)
R=∑𝑁 2
𝑗=1 𝑐𝑗 (𝑗𝜋) 𝑐𝑜𝑠𝑗𝜋𝑥 – cos𝜋𝑥2
𝜕𝑅
And =(𝑖𝜋)2cosiπx
𝜕𝐶𝑖
Thus the variational solutions coincide with exact solution
U(x)=cosπx/π2 ans.
Problem 2.22: Find the first two eigenvalues associated with the differential equation
𝑑2 𝑢
− 𝑑𝑥 2 = λu, 0<x<1
u(0) = 0, u(1) + uʹ(1)=0
use the least squares method. Use the operator definition to be
𝑑2
A = −(𝑑𝑥 2 )
to avoid increasing the degree of the characteristic polynomial for λ.
Solution: By definition,
𝑑2
A=− 𝑑𝑥 2 - λ
1 1
∫0 𝐴(𝛷𝑖 )Rdx=∑𝑛𝑗=1[ ∫0 𝐴(𝛷𝑖 ) 𝐴(Φj)dx]cj=0
1 𝑑2 𝛷 𝑑 2 𝛷𝑖
∑𝑛𝑗=1[ ∫0 ( 2𝑖 + λΦi )( + λΦj )dx]cj
𝑑𝑥 𝑑𝑥 2
1 𝑑 2 𝛷𝑖 𝑑 2 𝛷𝑗 𝑑 2 𝛷𝑗 𝑑 2 𝛷𝑖
∑𝑛𝑗=1{∫0 [ + λ(𝛷𝑖 + 𝛷𝑗 )+ λ2 𝛷𝑖 𝛷𝑗 ]𝑑𝑥}cj (1)
𝑑𝑥 2 𝑑𝑥 2 𝑑𝑥 2 𝑑𝑥 2
This is a quadratic (matrix) eigenvalue problem, and it is more difficult (but not impossible)
to solve.
Alternatively, we identify the operator A of the problem to be A = −d2/dx2 so
that it does not include the unknown, λ (not consistent with the definition of the
method). Then
1 1
ϕi[(∫0 𝐴(𝛷𝑖 )𝑅𝑑𝑥)] = ∑𝑛𝑗=1{∫0 𝐴( 𝛷𝑗 ) − λ𝛷𝑗 ] 𝑑𝑥} cj
1 𝑑 2 𝛷𝑖 𝑑 2 𝛷𝑗 𝑑 2 𝛷𝑖
= ∑𝑛𝑗=1[∫0 ( +λ 𝛷𝑗 )𝑑𝑥]cj
𝑑𝑥 2 𝑑𝑥 2 𝑑𝑥 2
1 1 𝑑 2 𝛷 𝑖 𝑑 2 𝛷𝑗
𝑘𝑖𝑗 = ∫0 𝐴( 𝛷𝑖 )𝐴(𝛷𝑗 )𝑑𝑥 = ∫0 𝑑𝑥
𝑑𝑥 2 𝑑𝑥 2
1 1 𝑑 2 𝛷𝑖
Mij = ∫0 𝐴( 𝛷𝑖 )𝛷𝑗 𝑑𝑥 = − ∫0 𝛷𝑗 𝑑𝑥 (2b)
𝑑𝑥 2
u=a+bx+cx2
or, u’=b+2cx
or, a=0
b+c+b+2c=0
2𝑏
or, c=− 3
2𝑏 2
Now, u=bx− x
3
So, a+b+c+2bx+3cx2=0
Or, 3b+4c=0
3𝑏
Or, C=− 4
3𝑥 3
So, 𝛷1 =bx2 − 4 =4x2-3x3
Using the approximation functions,
10 8 38
M11= 3
, M12= 3 = M21, M22= 15