User:Eml5526.s11.team5.srv/hw5

Home Work 5.2
Solving the differential euation using weak form with appropriate basis functions which satisfy constraint breaking solution

P.D.E

 * {| style="width:100%" border="0"

$$ \frac{\partial}{\partial x} \left[ (2+3x) \frac{\partial u}{\partial x} \right] + 5x = 0 \ \ \forall x \in \left] 0,1 \right[ $$ $$
 * style="width:95%" |
 * style="width:95%" |
 *  $$ \displaystyle                                                                          (Eq. 5.2.1)
 * }

Boundary Conditions

 * {| style="width:100%" border="0"

$$u \ at \ {x=1} \ is \ 4 $$ $$
 * style="width:95%" |
 * style="width:95%" |
 *  $$ \displaystyle                                                                          (Eq. 5.2.2)
 * }


 * {| style="width:100%" border="0"

$$  \frac{\partial u}{\partial x} \  at \ x = 0 \ is \ -6 $$ $$
 * style="width:95%" |
 * style="width:95%" |
 *  $$ \displaystyle                                                                          (Eq. 5.2.3)
 * }

Find
 Find approximate solution using weak form and compare it to exact one


 * Consider basis function satisfying constraint basis solution $$ \boldsymbol{F_{I}}, \ where \ I = p, f , e $$


 * Compute $$ u_n^h (x = 0.5) \quad $$ for $$ n = 2, 4, 6..... \quad $$ until convergence of $$ u^h (0.5)\ to \ 0(10^{-6}) $$


 * error


 * {| style="width:100%" border="0"

$$ e_n(0.5) = u_n(0.5) - u_n^h(0.5) \quad $$ $$
 * style="width:95%" |
 * style="width:95%" |
 *  $$ \displaystyle                                                                       (Eq. 5.2.4)
 * }


 * Plot $$ e_n(0.5) \quad $$ vs. $$ n \quad $$

Solution
Strong form


 * {| style="width:100%" border="0"

$$ \frac{\partial}{\partial x} \left[ (2+3x) \frac{\partial u}{\partial x} \right] + 5x = 0 \ \ \forall x \in \left] 0,1 \right[ $$ $$
 * style="width:95%" |
 * style="width:95%" |
 *  $$ \displaystyle                                                                       (Eq. 5.2.5)
 * }

Boundary conditions


 * {| style="width:100%" border="0"

$$u \ at \ {x=1} \ is \ 4 $$ $$
 * style="width:95%" |
 * style="width:95%" |
 *  $$ \displaystyle                                                                          (Eq. 5.2.6)
 * }


 * {| style="width:100%" border="0"

$$  \frac{\partial u}{\partial x} \  at \ x = 0 \ is \ -6 $$ $$
 * style="width:95%" |
 * style="width:95%" |
 *  $$ \displaystyle                                                                          (Eq. 5.2.7)
 * }

The exact solution of the displacement can be found as follows.

Differentiating eqn 5.2.5, we get,


 * {| style="width:100%" border="0"

$$ (2+3x)\frac{\partial u}{\partial x} + \frac{5x^2}{2} = c_1 $$ $$
 * style="width:95%" |
 * style="width:95%" |
 *  $$ \displaystyle                                                                          (Eq. 5.2.8)
 * }

Substituting the natural B.C in the above equation, we get,

<span id="(1)">
 * {| style="width:100%" border="0"

$$ c_1 = -12 \quad$$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.2.9)
 * }

Therefore eqn 5.2.8 becomes,

<span id="(1)">
 * {| style="width:100%" border="0"

$$ (2+3x)\frac{\partial u}{\partial x} + \frac{5x^2}{2} = -12 $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.2.10)
 * }

<span id="(1)">
 * {| style="width:100%" border="0"

$$\frac{\partial u}{\partial x} = \frac{-12-\frac{5x^2}{2}}{(2+3x)} $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.2.11)
 * }

Integrating the above equation, we get,

<span id="(1)">
 * {| style="width:100%" border="0"

$$u = \frac{1}{108}(-45x^2 + 60x - 472 log (2+3x) +60 ) + c_2 $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.2.12)
 * }

Substituting the Essential B.C in the above equation, we get,

<span id="(1)">
 * {| style="width:100%" border="0"

$$c_2 = 10.3394 \quad$$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.2.13)
 * }

<span id="(1)">
 * {| style="width:100%" border="0"

$$u = \frac{1}{108}(-45x^2 + 60x - 472 log (2+3x) +60 ) + 10.3394 $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.2.14)
 * }

Weak Form

<span id="(1)">
 * {| style="width:100%" border="0"

$$  \sum_{i} c_i \left [ \sum_{j} \left \{ \tilde{K_{ij}} \tilde{d_j} \right \} - \tilde{F_i} \right ] = 0 $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.2.15)
 * }

where,

<span id="(1)">
 * {| style="width:100%" border="0"

$$\tilde{K_{ij}} = \int_{0}^{1} b_i' \ a_2 \ b_j ' \ dx $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.2.16)
 * }

<span id="(1)">
 * {| style="width:100%" border="0"

$$ \tilde{F_i} = b_i (\alpha )h + \int_{0}^{1} b_i f dx $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.2.17)
 * }

Using Polynomial Basis Functions:

<span id="(1)">
 * {| style="width:100%" border="0"

$$b_j = (x-1)^j \ where \ j = 0,1,2,... $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.2.18)
 * }

Let us try for n = 2;

<span id="(1)">
 * {| style="width:100%" border="0"

$$ b_j = [ 1 \quad (x-1) \quad (x-1)^2]$$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.2.19)
 * }

We know that,

<span id="(1)">
 * {| style="width:100%" border="0"

$$ u^h (x) = \sum_{0}^{2} d_j b_j(x) = d_0 + (x-1)d_1 + (x-1)^2 d_2 $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.2.20)
 * }

Substituting the essential B.C;

<span id="(1)">
 * {| style="width:100%" border="0"

$$ d_0 = 4 \quad $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.2.21)
 * }

<span id="(1)">
 * {| style="width:100%" border="0"

$$ b_j' = [ 0 \quad 1 \quad 2(x-1)] $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.2.22)
 * }

<span id="(1)">
 * {| style="width:100%" border="0"

$$K_{01} = K_{10} = K_{02} = K_{20} = 0 \quad $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.2.23)
 * }

<span id="(1)">
 * {| style="width:100%" border="0"

$$ K_{11} = \int_{0}^{1}(1)(2+3x)(1)dx = 3.5 $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.2.24)
 * }

<span id="(1)">
 * {| style="width:100%" border="0"

$$ K_{12} = K_{21} = \int_{0}^{1}(1)(2+3x)2(x-1)(1)dx = 2\int_{0}^{1}(3x^2-x-2)dx = -3 $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.2.25)
 * }

<span id="(1)">
 * {| style="width:100%" border="0"

$$K_{22} = \int_{0}^{1}2(x-1)(2+3x)2(x-1)dx = 4\int_{0}^{1}(2+3x)(x-1)dx = 3.6667 $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.2.26)
 * }

<span id="(1)">
 * {| style="width:100%" border="0"

$$ F_0 = b_0(\alpha)(12) + \int_{0}^{1}b_0 (5x)dx = (1)(12) + \int_{0}^{1} 5xdx = 14.5 $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.2.27)
 * }

<span id="(1)">
 * {| style="width:100%" border="0"

$$F_1 = b_1(\alpha)(12) + \int_{0}^{1}b_1 (5x)dx = (-1)(12) + \int_{0}^{1} 5x(x-1)dx = -12.833 $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.2.28)
 * }

<span id="(1)">
 * {| style="width:100%" border="0"

$$ F_2 = b_2(\alpha)(12) + \int_{0}^{1}b_2 (5x)dx = (12) + \int_{0}^{1} 5x(x-1)^2dx = 12.4166 $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.2.29)
 * }

Hence we obtain 3 linearly independent equations, (i.e) one from the essential boundary condition and the other two from the weak form. These three equations can be written in matrix form as follows.

<span id="(1)">
 * {| style="width:100%" border="0"

$$ K.d = F \quad $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle
 * }

<span id="(1)">
 * {| style="width:100%" border="0"

$$ \begin{bmatrix} 1 & 0 & 0\\ 0& 3.5 & -3\\  0&  -3 & 3.6667  \end{bmatrix} \begin{Bmatrix} d_0\\ d_1 \\ d_2 \end{Bmatrix} = \begin{Bmatrix} 4\\ -12.833 \\ 12.4166 \end{Bmatrix}$$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.2.30)
 * }

Solving for $$ d_0 \quad $$, $$ d_1 \quad$$ and $$ d_2 \quad$$ , we get,

<span id="(1)">
 * {| style="width:100%" border="0"

$$ d_0 = 4; \qquad d_1 = -2.55768; \qquad d_2 = 1.2937$$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.2.31)
 * }

Therefore the displacement equation is given by ,

<span id="(1)">
 * {| style="width:100%" border="0"

$$ u^h(x) = 4-2.55768(x-1) + 1.2937(x-1)^2 \quad $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.2.32)
 * }

At $$ x = 0.5 \quad $$ ,

<span id="(1)">
 * {| style="width:100%" border="0"

$$ u^h(0.5) = 4-2.55768(0.5-1) + 1.2937(0.5-1)^2 = 5.602265 \quad $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.2.33)
 * }

The exact solution can be found from the eqn. 5.2.14. It is given by ,

<span id="(1)">
 * {| style="width:100%" border="0"

$$ u(0.5) = 5.59352829 \quad$$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle
 * }

Hence the error we get for $$ n = 2 $$ is ,

<span id="(1)">
 * {| style="width:100%" border="0"

$$u^h(0.5) - u(0.5) = 8.74117 \times 10^{-3} \quad$$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.2.34)
 * }

The outputs are as follow:

$$ \int_\omega

\begin{bmatrix} cos(\phi)  \\ cos(x+\phi) \\ cos(2x+\phi) \end{bmatrix}

[2(0 - d_1cos(x+\phi) - 4d_2cos(2x+\phi))] dx := $$ 0   0.3818   -1.0137         0    0.2919    0.7126         0    0.1781    2.3464

$$ \int_\omega

\begin{bmatrix} cos(\phi)  \\ cos(x+\phi) \\ cos(2x+\phi) \end{bmatrix} -3 dx \quad := $$

2.1213   0.8099   -0.5376



P.D.E
<span id="(1)">
 * {| style="width:100%" border="0"

$$ \frac{\partial}{\partial x} \left[ (2+3x) \frac{\partial u}{\partial x} \right] + 5x = 0 \ \ \forall x \in \left] 0,1 \right[ $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.1.1)
 * }

Boundary Conditions
<span id="(1)">
 * {| style="width:100%" border="0"

$$u \ at \ {x=0} \ is \ 4 $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.1.2)
 * }

<span id="(1)">
 * {| style="width:100%" border="0"

$$  \frac{\partial u}{\partial x} \  at \ x = 1 \ is \ \frac{12}{5} $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.1.3)
 * }

Finding the approximate solution using weak form and its comparison to exact solution

 * Consider basis function satisfying constraint basis solution $$ \boldsymbol{F_{I}}, \ where \ I = p, f , e $$


 * Compute $$ u_n^h (x = 0.5) \quad $$ for $$ n = 2, 4, 6..... \quad $$ until convergence of $$ u^h (0.5)\ to \ 0(10^{-6}) $$


 * error

<span id="(1)">
 * {| style="width:100%" border="0"

$$ e_n(0.5) = u_n(0.5) - u_n^h(0.5) \quad $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                       (Eq. 5.1.4)
 * }


 * Plot $$ e_n(0.5) \quad $$ vs. $$ n \quad $$

Solution
Strong form

<span id="(1)">
 * {| style="width:100%" border="0"

$$ \frac{\partial}{\partial x} \left[ (2+3x) \frac{\partial u}{\partial x} \right] + 5x = 0 \ \ \forall x \in \left] 0,1 \right[ $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                       (Eq. 5.1.5)
 * }

Boundary conditions

<span id="(1)">
 * {| style="width:100%" border="0"

$$u \ at \ {x=0} \ is \ 4 $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.1.6)
 * }

<span id="(1)">
 * {| style="width:100%" border="0"

$$  \frac{\partial u}{\partial x} \  at \ x = 1 \ is \ \frac{12}{5} $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.1.7)
 * }

Finding of the Exact Solution
The exact solution of the displacement can be found as follows.

Integrating eqn 5.2.5, we get,

<span id="(1)">
 * {| style="width:100%" border="0"

$$ (2+3x)\frac{\partial u}{\partial x} + \frac{5x^2}{2} = c_1 $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.1.8)
 * }

Substituting the natural B.C in the above equation, we get,

<span id="(1)">
 * {| style="width:100%" border="0"

$$ c_1 = 14.5 \quad$$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.1.9)
 * }

Therefore eqn 5.1.8 becomes,

<span id="(1)">
 * {| style="width:100%" border="0"

$$ (2+3x)\frac{\partial u}{\partial x} + \frac{5x^2}{2} = 14.5 $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.1.10)
 * }

<span id="(1)">
 * {| style="width:100%" border="0"

$$\frac{\partial u}{\partial x} = \frac{14.5-\frac{5x^2}{2}}{(2+3x)} $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.1.11)
 * }

Integrating the above equation, we get,Reference : www.wolframalpha.com

<span id="(1)">
 * {| style="width:100%" border="0"

$$u = \frac{1}{108}(-45x^2 + 60x + 482 log (2+3x) +60 ) + c_2 $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.1.12)
 * }

Substituting the Essential B.C in the above equation, we get,

<span id="(1)">
 * {| style="width:100%" border="0"

$$c_2 = 0.3509542497 \quad$$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.1.13)
 * }

<span id="(1)">
 * {| style="width:100%" border="0"

$$u = \frac{1}{108}(-45x^2 + 60x + 482 log (2+3x) +60 ) + 0.3509542497 $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.1.14)
 * }

Finding of the Approximate Solution using Weak form
Weak Form

<span id="(1)">
 * {| style="width:100%" border="0"

$$  \sum_{i} c_i \left [ \sum_{j} \left \{ \tilde{K_{ij}} \tilde{d_j} \right \} - \tilde{F_i} \right ] = 0 $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.1.15)
 * }

where,

<span id="(1)">
 * {| style="width:100%" border="0"

$$\tilde{K_{ij}} = \int_{0}^{1} b_i' \ a_2 \ b_j ' \ dx $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.1.16)
 * }

<span id="(1)">
 * {| style="width:100%" border="0"

$$ \tilde{F_i} = b_i (\alpha )h + \int_{0}^{1} b_i f dx $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.1.17)
 * }

Finding of the Approximate Solution using Polynomial Basis Function satisfying Constraint Breaking Solution in Weak form
<span id="(1)">
 * {| style="width:100%" border="0"

$$b_j = x^j \ where \ j = 0,1,2,... $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.1.18)
 * }

Let us try for n = 2;

<span id="(1)">
 * {| style="width:100%" border="0"

$$ b_j = [ 1 \quad (x) \quad (x)^2]$$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.1.19)
 * }

We know that,

<span id="(1)">
 * {| style="width:100%" border="0"

$$ u^h (x) = \sum_{0}^{2} d_j b_j(x) = d_0 + (x)d_1 + (x)^2 d_2 $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.1.20)
 * }

Substituting the essential B.C;

<span id="(1)">
 * {| style="width:100%" border="0"

$$ d_0 = 4 \quad $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.1.21)
 * }

<span id="(1)">
 * {| style="width:100%" border="0"

$$ b_j' = [ 0 \quad 1 \quad 2(x)] $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.1.22)
 * }

<span id="(1)">
 * {| style="width:100%" border="0"

$$K_{01} = K_{10} = K_{02} = K_{20} = 0 \quad $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.1.23)
 * }

<span id="(1)">
 * {| style="width:100%" border="0"

$$ K_{11} = \int_{0}^{1}(1)(2+3x)(1)dx = 3.5 $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.1.24)
 * }

<span id="(1)">
 * {| style="width:100%" border="0"

$$ K_{12} = K_{21} = \int_{0}^{1}(1)(2+3x)2(x)(1)dx = 2\int_{0}^{1}(3x^2-x-2)dx = 4 $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.1.25)
 * }

<span id="(1)">
 * {| style="width:100%" border="0"

$$K_{22} = \int_{0}^{1}2(x)(2+3x)2(x)dx = 4\int_{0}^{1}(2+3x)(x)dx = 5.6667 $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.1.26)
 * }

<span id="(1)">
 * {| style="width:100%" border="0"

$$ F_0 = b_0(\alpha)(12) + \int_{0}^{1}b_0 (5x)dx = (1)(12) + \int_{0}^{1} 5xdx = 14.5 $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.1.27)
 * }

<span id="(1)">
 * {| style="width:100%" border="0"

$$F_1 = b_1(\alpha)(12) + \int_{0}^{1}b_1 (5x)dx = (1)(12) + \int_{0}^{1} 5x(x)dx = 13.6667 $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.1.28)
 * }

<span id="(1)">
 * {| style="width:100%" border="0"

$$ F_2 = b_2(\alpha)(12) + \int_{0}^{1}b_2 (5x)dx = (12) + \int_{0}^{1} 5x(x)^2dx = 13.25 $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.1.29)
 * }

Hence we obtain 3 linearly independent equations, (i.e) one from the essential boundary condition and the other two from the weak form. These three equations can be written in matrix form as follows.

<span id="(1)">
 * {| style="width:100%" border="0"

$$ K.d = F \quad $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle
 * }

<span id="(1)">
 * {| style="width:100%" border="0"

$$ \begin{bmatrix} 1 & 0 & 0\\ 0& 3.5 & 4\\  0&  4 & 5.6667  \end{bmatrix} \begin{Bmatrix} d_0\\ d_1 \\ d_2 \end{Bmatrix} = \begin{Bmatrix} 4\\ 13.6667 \\ 13.25 \end{Bmatrix}$$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.1.30)
 * }

Solving for $$ d_0 \quad $$, $$ d_1 \quad$$ and $$ d_2 \quad$$ , we get,

<span id="(1)">
 * {| style="width:100%" border="0"

$$ d_0 = 4; \qquad d_1 = 6.3769; \qquad d_2 = -2.1631$$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.1.31)
 * }

Therefore the displacement equation is given by ,

<span id="(1)">
 * {| style="width:100%" border="0"

$$ u^h(x) = 4+6.3769(x) -2.1631(x)^2 \quad $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.1.32)
 * }

At $$ x = 0.5 \quad $$ ,

<span id="(1)">
 * {| style="width:100%" border="0"

$$ u^h(0.5) = 4+6.3769(0.5) -2.1631(0.5)^2 = 6.647675 \quad $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.1.33)
 * }

The exact solution can be found from the eqn. 5.1.14. It is given by ,

<span id="(1)">
 * {| style="width:100%" border="0"

$$ u(0.5) = 6.671155 \quad$$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle
 * }

Hence the error we get for $$ n = 2 $$ is ,

<span id="(1)">
 * {| style="width:100%" border="0"

$$u^h(0.5) - u(0.5) = -0.023480 \quad$$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 5.1.34)
 * }

MATLAB code with output
The K matrix and F matrix which we get for the convergence upto 10^-6 is as follows:

K =

1        0         0         0         0         0         0         0         0         0    3.5000    4.0000    4.2500    4.4000    4.5000    4.5714    4.6250    4.6667         0    4.0000    5.6667    6.6000    7.2000    7.6190    7.9286    8.1667    8.3556         0    4.2500    6.6000    8.1000    9.1429    9.9107   10.5000   10.9667   11.3455         0    4.4000    7.2000    9.1429   10.5714   11.6667   12.5333   13.2364   13.8182         0    4.5000    7.6190    9.9107   11.6667   13.0556   14.1818   15.1136   15.8974         0    4.5714    7.9286   10.5000   12.5333   14.1818   15.5455   16.6923   17.6703         0    4.6250    8.1667   10.9667   13.2364   15.1136   16.6923   18.0385   19.2000         0    4.6667    8.3556   11.3455   13.8182   15.8974   17.6703   19.2000   20.5333

F =

[4  13.6667   13.2500   13.0000   12.8333   12.7143   12.6250   12.5556   12.5000]^T

d =

[4.0000   7.2498   -5.4295    4.9208   -5.0302    4.5192   -3.0193    1.2522   -0.2348]^T

The outputs are as follow:

@x=0.5 Exact U=6.671156e+000

U(weak form) for n=2 = 6.647645e+000

Error at n=2 is 2.351072e-002

@x=0.5 Exact U=6.671156e+000

U(weak form) for n=3 = 6.678544e+000

Error at n=3 is 7.388478e-003

@x=0.5 Exact U=6.671156e+000

U(weak form) for n=4 = 6.671260e+000

Error at n=4 is 1.047460e-004

@x=0.5 Exact U=6.671156e+000

U(weak form) for n=5 = 6.670884e+000

Error at n=5 is 2.712998e-004

@x=0.5 Exact U=6.671156e+000

U(weak form) for n=6 = 6.671152e+000

Error at n=6 is 3.583888e-006

@x=0.5 Exact U=6.671156e+000

U(weak form) for n=7 = 6.671166e+000

Error at n=7 is 1.009645e-005

@x=0.5 Exact U=6.671156e+000

U(weak form) for n=8 = 6.671156e+000

Error at n=8 is 9.634049e-008



Finding of the Approximate Solution using Fourier Basis Function satisfying Constraint Breaking Solution in Weak form
For $$ n = 1 \quad $$ Referencewww.wolframalpha.com

Referencewww.wolframalpha.com

Referencewww.wolframalpha.com

Referencewww.wolframalpha.com

Referencewww.wolframalpha.com

MATLAB code with output
The K matrix and F matrix which we get for the convergence upto 10^-6 is as follows:

K =

1        0         0         0         0         0         0         0         0         0    1.1444   -1.3612    3.2564   -0.5408    3.7008    2.3208    1.2335    4.7249         0   -1.3612    2.3556   -4.1866    2.4001   -5.8462   -0.0674   -4.7299   -2.9460         0    3.2564   -4.1866    9.5121   -2.3503   11.6194    5.4649    5.7892   12.8497         0   -0.5408    2.4001   -2.3503    4.4879   -5.4725    5.3501   -8.9290    3.8999         0    3.7008   -5.8462   11.6194   -5.4725   16.8127    2.2054   14.2443   12.2128         0    2.3208   -0.0674    5.4649    5.3501    2.2054   14.6873   -9.6620   19.6948         0    1.2335   -4.7299    5.7892   -8.9290   14.2443   -9.6620   23.4828   -3.0985         0    4.7249   -2.9460   12.8497    3.8999   12.2128   19.6948   -3.0985   32.5172

F =

[4  -6.1075   11.6035  -18.9907   13.0886  -27.2503    3.4218  -23.8065   -8.5011]^T

d =

[4.0000   47.4091   48.5755   -3.4993  -30.6212   -4.1185    7.2053    0.9062   -0.4248]^T

The outputs are as follow:

@x=0.5 Exact U=6.671156e+000

U(weak form) for n=1 = 6.619837e+000

Error at n=1 is 5.131875e-002

@x=0.5 Exact U=6.671156e+000

U(weak form) for n=2 = 6.671392e+000

Error at n=2 is 2.367707e-004

@x=0.5 Exact U=6.671156e+000

U(weak form) for n=3 = 6.671145e+000

Error at n=3 is 1.055939e-005

@x=0.5 Exact U=6.671156e+000

U(weak form) for n=4 = 6.671156e+000

Error at n=4 is 3.459119e-007



Finding of the Approximate Solution using Exponential Basis Function satisfying Constraint Breaking Solution in Weak form
For $$ n = 2 \quad $$ Referencewww.wolframalpha.com

Referencewww.wolframalpha.com

Referencewww.wolframalpha.com

Referencewww.wolframalpha.com

Referencewww.wolframalpha.com

MATLAB code with output
The K matrix and F matrix which we get for the convergence upto 10^-6 is as follows:

K =

1.0e+008 *

1        0         0         0         0         0         0         0         0         0    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0001    0.0003         0    0.0000    0.0000    0.0000    0.0000    0.0001    0.0002    0.0006    0.0017         0    0.0000    0.0000    0.0000    0.0001    0.0003    0.0008    0.0022    0.0062         0    0.0000    0.0000    0.0001    0.0003    0.0008    0.0025    0.0072    0.0206         0    0.0000    0.0001    0.0003    0.0008    0.0026    0.0077    0.0225    0.0649         0    0.0000    0.0002    0.0008    0.0025    0.0077    0.0232    0.0682    0.1973         0    0.0001    0.0006    0.0022    0.0072    0.0225    0.0682    0.2014    0.5858         0    0.0003    0.0017    0.0062    0.0206    0.0649    0.1973    0.5858    1.7106

F =

1.0e+004 * [4  0.0023    0.0085    0.0249    0.0692    0.1885    0.5107    1.3817    3.7387]^T

d =

[4.0000  171.4273 -268.6688  254.1458 -153.5759   59.9076  -14.6354    2.0398   -0.1239]^T

The outputs are as follow:

@x=0.5 Exact U=6.671156e+000

U(weak form) for n=2 = 6.328507e+000

Error at n=2 is 3.426491e-001

@x=0.5 Exact U=6.671156e+000

U(weak form) for n=3 = 6.661733e+000

Error at n=3 is 9.422741e-003

@x=0.5 Exact U=6.671156e+000

U(weak form) for n=4 = 6.681880e+000

Error at n=4 is 1.072431e-002

@x=0.5 Exact U=6.671156e+000

U(weak form) for n=5 = 6.670738e+000

Error at n=5 is 4.179779e-004

@x=0.5 Exact U=6.671156e+000

U(weak form) for n=6 = 6.669725e+000

Error at n=6 is 1.431086e-003

@x=0.5 Exact U=6.671156e+000

U(weak form) for n=7 = 6.670941e+000

Error at n=7 is 2.143177e-004

@x=0.5 Exact U=6.671156e+000

U(weak form) for n=8 = 6.671171e+000

Error at n=8 is 1.566386e-005

>>