User:Lokeshdahiya

= Licensing =

= HW 2.1 =

Problem
Derive the expression for the Differential Equation in the 1-D Heat Problem

Find
By taking infinitesimal slice of the bar (shown in red in Figure 1),$$ dx $$, develop expression for elastodynamic response in Heat Problem in 1-D

Solution
Heat is transferred in the form of Conduction, Convection and Thermal Radiation. In this problem we will do Heat Conduction only.

Here we have consider a small infinitesimal portion of wall of thickness dx as shown in figure.

Let,The Heat Flux is represented by $$ \quad q$$.

{| style="width:100%" border="0" Here $$ \quad \tilde{m}(x) =\quad m(x).c$$ --Lokeshdahiya 20:32, 2 February 2011 (UTC)
 * style="width:95%" |
 * style="width:95%" |

= HW 3.2 = = 3.2 For the spring mass system given in Exercise 2.1 in Fish and Belytschko =

Find
a) Number the elements and nodes.

b) Assemble the Global Stiffness Matrix and Force Matrix.

c) Partition the system and solve for the Nodal Displacements.

d) Compute the Reaction Forces.

$$ \mathbf{Part(c) : Partitioning \quad of \quad the \quad system \quad and \quad solution \quad for \quad the \quad Nodal \quad Displacements. } $$

 * }

$$ \mathbf{Part(d) : Computing \quad of \quad Reaction \quad forces. } $$
=5.2=

Solution
(1)

For $$ n = 1 \quad $$

exp
For $$ n = 2 \quad $$

=5.3=

Solution
(1)

For $$ n = 1 \quad $$

exp
For $$ n = 2 \quad $$

=5.1 Solving G1DM1.0/D1(b) using weak form with appropriate basis functions(polynomial, Fourier, Exponential) 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.1.1)
 * }

Boundary Conditions

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

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


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

$$  \frac{\partial u}{\partial x} \  at \ x = 1 \ is \ \frac{12}{5} $$ $$
 * style="width:95%" |
 * style="width:95%" |
 *  $$ \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


 * {| 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.1.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.1.5)
 * }

Boundary conditions


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

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


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

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

Finding of the Exact Solution
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.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,

<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 $$

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 $$

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

>>

Convergence Plot
=5.2 Solving G1DM1.0/D1 using weak form with appropriate basis functions(polynomial, Fourier, Exponential) which satisfy constraint breaking solution=

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.2.1)
 * }

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

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

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

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

Finding the approximate solution using weak form and its comparison to exact solution
 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

<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.2.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.2.5)
 * }

Boundary conditions

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

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

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

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

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

Differentiating 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.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)
 * }

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.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)
 * }

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-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)
 * }

MATLAB code with output
The K,d and F matrix are as follow:

K =

1        0         0         0         0         0         0         0         0         0    3.5000   -3.0000    2.7500   -2.6000    2.5000   -2.4286    2.3750   -2.3333         0   -3.0000    3.6667   -3.9000    4.0000   -4.0476    4.0714   -4.0833    4.0889         0    2.7500   -3.9000    4.5000   -4.8571    5.0893   -5.2500    5.3667   -5.4545         0   -2.6000    4.0000   -4.8571    5.4286   -5.8333    6.1333   -6.3636    6.5455         0    2.5000   -4.0476    5.0893   -5.8333    6.3889   -6.8182    7.1591   -7.4359         0   -2.4286    4.0714   -5.2500    6.1333   -6.8182    7.3636   -7.8077    8.1758         0    2.3750   -4.0833    5.3667   -6.3636    7.1591   -7.8077    8.3462   -8.8000         0   -2.3333    4.0889   -5.4545    6.5455   -7.4359    8.1758   -8.8000    9.3333

F =

[4 -12.8333   12.4167  -12.2500   12.1667  -12.1190   12.0893  -12.0694   12.0556]^T

d =

[4.0000  -2.8999    0.3731   -0.2799    0.3240    0.4387    0.8107    0.6131    0.2299]^T



The outputs are as follow:

@x=0.5 Exact U=5.593524e+000

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

Error at n=2 is 8.831243e-003

@x=0.5 Exact U=5.593524e+000

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

Error at n=3 is 7.978831e-003

@x=0.5 Exact U=5.593524e+000

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

Error at n=4 is 1.409517e-004

@x=0.5 Exact U=5.593524e+000

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

Error at n=5 is 2.637038e-004

@x=0.5 Exact U=5.593524e+000

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

Error at n=6 is 3.409184e-006

@x=0.5 Exact U=5.593524e+000

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

Error at n=7 is 9.890659e-006

@x=0.5 Exact U=5.593524e+000

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

Error at n=8 is 1.058885e-007



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

MATLAB code with output
The K,d and F matrix are as follows:

K =

1        0         0         0         0         0         0         0         0         0    0.7643    1.1171    2.3046    0.8846    3.0596   -0.7732    2.1100   -2.5560         0    1.1171    2.7357    3.6746    3.8194    5.9293    2.8546    6.5625    0.9196         0    2.3046    3.6746    7.1367    3.4374   10.0789   -1.1801    8.2449   -6.7905         0    0.8846    3.8194    3.4374    6.8633    7.1898    8.2933   11.0829    7.5264         0    3.0596    5.9293   10.0789    7.1898   16.1542    2.4145   17.1555   -5.6179         0   -0.7732    2.8546   -1.1801    8.2933    2.4145   15.3458   11.1219   19.5889         0    2.1100    6.5625    8.2449   11.0829   17.1555   11.1219   25.5917    4.9200         0   -2.5560    0.9196   -6.7905    7.5264   -5.6179   19.5889    4.9200   30.4083

F =

[4  -5.7179  -10.8903  -17.7236  -12.2749  -25.2744   -3.2817  -21.8270    7.5951]^T

d =

[4.0000 -62.5673   12.4807   25.5617  -15.3711   -4.9628    6.3734    0.2645   -0.9396]^T

The outputs are as follows:

@x=0.5 Exact U=5.593524e+000

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

Error at n=1 is 1.244042e-002

@x=0.5 Exact U=5.593524e+000

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

Error at n=2 is 3.531293e-004

@x=0.5 Exact U=5.593524e+000

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

Error at n=3 is 9.958579e-006

@x=0.5 Exact U=5.593524e+000

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

Error at n=4 is 3.393677e-007

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

MATLAB code with output
The K,d and F matrix for 2 elements only are as follows:

K =

10.8333 -12.6667    1.8333         0         0  -12.6667   29.3333  -16.6667         0         0    1.8333  -16.6667   32.6667  -20.6667    2.8333         0         0  -20.6667   45.3333  -24.6667         0         0    2.8333  -24.6667   21.8333

F =

[0   0.416666666666667    0.416666666666667    1.25000000000000    12.416666666666667]^T

d =

[4   5.53116172316385     6.66984463276837     7.54458967938842     8.22680850223224]^T

The outputs for convergence are as follows:

@x=0.5 Exact U=6.671156e+000

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

Error at n=2 is 1.311013e-003

@x=0.5 Exact U=6.671156e+000

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

Error at n=4 is 1.003161e-004

@x=0.5 Exact U=6.671156e+000

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

Error at n=6 is 2.076369e-005

@x=0.5 Exact U=6.671156e+000

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

Error at n=8 is 6.685488e-006

@x=0.5 Exact U=6.671156e+000

U(weak form) for n=10 = 6.671153e+000

Error at n=10 is 2.761216e-006

@x=0.5 Exact U=6.671156e+000

U(weak form) for n=12 = 6.671154e+000

Error at n=12 is 1.337704e-006

@x=0.5 Exact U=6.671156e+000

U(weak form) for n=14 = 6.671155e+000

Error at n=14 is 7.240625e-007

= 6.1 [ Solving G1DM1.0/D1(b) using weak form with QLEBF (Quadratic Lagrangian Element Basis Functions)] =

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. 6.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. 6.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. 6.1.3)
 * }

Find: Approximate solution using weak form and its comparison to exact solution

 * Consider basis function QLEBF satisfying constraint basis solution


 * 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. 6.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. 6.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. 6.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. 6.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. 6.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. 6.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. 6.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. 6.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. 6.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. 6.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. 6.1.14)
 * }

Finding of the Approximate Solution using Weak form with QLEBF
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. 6.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. 6.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. 6.1.17)
 * }

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


 * style="width:95%" |
 * style="width:95%" |

Ist Basis Function: $$b_{1}^{(1)}=L_{1,3}=\frac{(x-x_{2}).(x-x_{3})}{(x_{1}-x_{2}).(x_{1}-x_{3})}=\frac{(x-0.25).(x-0.5)}{(0-0.25).(0-0.5)}=8x^{2}-6x+1 $$

$$
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.1.18)
 * }

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


 * style="width:95%" |
 * style="width:95%" |

IInd Basis Function: $$b_{2}^{(1)}=L_{2,3}=\frac{(x-x_{1}).(x-x_{3})}{(x_{2}-x_{1}).(x_{2}-x_{3})}=\frac{(x-0).(x-0.5)}{(0.25-0).(0.25-0.5)}=-16x^{2}+8x $$

$$ <span id="(1)">
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.1.19)
 * }
 * {| style="width:100%" border="0"


 * style="width:95%" |
 * style="width:95%" |

IIIrd Basis Function : $$b_{3}^{(1)}=L_{3,3}=\frac{(x-x_{1}).(x-x_{2})}{(x_{3}-x_{1}).(x_{3}-x_{2})}=\frac{(x-0).(x-0.25)}{(0.5-0).(0.5-0.25)}=8x^{2}-2x $$

$$ <span id="(1)">
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.1.20)
 * }
 * {| style="width:100%" border="0"


 * style="width:95%" |
 * style="width:95%" |

$${b_{1}^{(1)}}'=16x-6, \quad\quad {b_{2}^{(1)}}'=-32x+8 , \quad\quad {b_{3}^{(1)}}'=16x-2 $$

$$
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.1.21)
 * }

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


 * style="width:95%" |
 * style="width:95%" |

As we know from the definition of K matrix <span id="(1)">
 * }
 * {| style="width:100%" border="0"

$$ \mathbf{K_{ij}^{(1)}}=\int_{\alpha }^{\beta }{b_{i}^{(1)}}'.a_{2}.{b_{j}^{(1)}}'dx $$
 * style="width:95%" |
 * style="width:95%" |

$$ <span id="(1)">
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.1.21)
 * }
 * {| style="width:100%" border="0"

So, the elements of K matrix are:
 * style="width:95%" |
 * style="width:95%" |
 * }

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

$$ \mathbf{K_{11}^{(1)}}=\int_{0 }^{0.5 }(16x-6).(2+3x).(16x-6)dx=10.8333 $$ $$ <span id="(1)">
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.1.21)
 * }
 * {| style="width:100%" border="0"

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

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

$$ \mathbf{K_{13}^{1}}=\mathbf{K_{31}^{(1)}}=\int_{0 }^{0.5 }(16x-6).(2+3x).(16x-2)dx=1.83333 $$ $$ <span id="(1)">
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.1.23)
 * }
 * {| style="width:100%" border="0"

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

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

$$ \mathbf{K_{23}^{(1)}}=\int_{0 }^{0.5 }(-32x+8).(2+3x).(16x-2)dx=-16.6667 $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.1.25)
 * }

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

$$ \mathbf{K_{33}^{(1)}}=\int_{0 }^{0.5 }(16x-2).(2+3x).(16x-2)dx=14.83333 $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.1.26)
 * }

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

S0, the Element Stiffness Matrix or Local Stiffness Matrix for the Element 1 is :
 * style="width:95%" |
 * style="width:95%" |
 * }

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


 * style="width:95%" |
 * style="width:95%" |

$$ \mathbf{k^{(1)}}=\begin{bmatrix} 10.8333 & -12.6667 & 1.83333 \\ -12.6667 & 29.3333 & -16.6667 \\ 1.83333 & -16.6667  & 14.83333 \end{bmatrix}

$$ $$
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.1.27)
 * }

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

As we know from the definition of weak form the Force Matrix is given by:
 * style="width:95%" |
 * style="width:95%" |
 * }

<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. 6.1.28)
 * }

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

So, the elements of force matrix are: <span id="(1)">
 * style="width:95%" |
 * style="width:95%" |
 * }
 * {| style="width:100%" border="0"

$$ f_{1}^{(1)}=\int_{0}^{0.5}(8x^{2}-6x+1).(5x)dx=0 $$
 * style="width:95%" |
 * style="width:95%" |
 * }

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

$$ f_{2}^{(1)}=\int_{0}^{0.5}(-16x^{2}+8x).(5x)dx=0.416667 $$
 * style="width:95%" |
 * style="width:95%" |
 * }

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

$$ f_{3}^{(1)}=\int_{0}^{0.5}(8x^{2}-2x).(5x)dx=0.2083333 $$
 * style="width:95%" |
 * style="width:95%" |
 * }

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

So, the Element Force Matrix for Element 1 is:
 * style="width:95%" |
 * style="width:95%" |
 * }

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


 * style="width:95%" |
 * style="width:95%" |

$$ \mathbf{f^{(1)}}=\begin{bmatrix} 0\\ 0.416667\\ 0.208333 \end{bmatrix} $$ $$
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.1.29)
 * }

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

The transformation from Local to Global is given by: <span id="(1)">
 * style="width:95%" |
 * style="width:95%" |
 * }
 * {| style="width:100%" border="0"

So, the global K and F matrices for Element 1 are given as:
 * style="width:95%" |
 * style="width:95%" |
 * }

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

$$ \mathbf{K^{e}}= \mathbf{L^{e^{T}}}.\mathbf{k^{e}}.\mathbf{L^{e}} $$ $$ <span id="(1)">
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.1.30)
 * }
 * {| style="width:100%" border="0"

$$ \mathbf{F^{e}}=\mathbf{L^{e^{T}}}.\mathbf{f^{e}} $$ $$ <span id="(1)">
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.1.31)
 * }
 * {| style="width:100%" border="0"

For Element 1 $$ \mathbf{L^{e}}=\mathbf{L^{1}} $$.
 * style="width:95%" |
 * style="width:95%" |
 * }

$$ \mathbf{L^{e}} \quad $$ For Element 1
<span id="(1)">
 * {| style="width:100%" border="0"

$$ \mathbf{L^{1}}=\begin{bmatrix} 1 &0 &0  &0  &0 \\ 0 &1  &0  &0  &0 \\ 0 &0  &1  &0  &0 \end{bmatrix} $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.1.32)
 * }

Global K,F matrices For Element 1
<span id="(1)">
 * {| style="width:100%" border="0"

$$ \mathbf{K^{1}}= \mathbf{L^{1^{T}}}.\mathbf{k^{1}}.\mathbf{L^{1}} $$
 * style="width:95%" |
 * style="width:95%" |
 * }

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

$$\mathbf{K^{1}}=\begin{bmatrix} 1 & 0 & 0\\ 0 & 1 & 0\\ 0 & 0 & 1\\ 0 & 0 & 0\\ 0 & 0 & 0 \end{bmatrix}\begin{bmatrix} 10.8333 & -12.6667 & 1.83333 \\ -12.6667 & 29.3333 & -16.6667 \\ 1.83333 & -16.6667  & 14.83333 \end{bmatrix}\begin{bmatrix} 1 &0 &0  &0  &0 \\ 0 &1  &0  &0  &0 \\ 0 &0  &1  &0  &0 \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }

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


 * style="width:95%" |
 * style="width:95%" |

$$ \Rightarrow \mathbf{K^{1}}=\begin{bmatrix} 10.8333 &-12.6667 &1.8333    &0  &0 \\ -12.667 &29.33333  &-16.6667  &0  &0 \\ 1.8333  & -16.6667 & 14.83333 &0  &0 \\ 0 &0  &0  &0  &0 \\ 0 &0  &0  &0  &0 \end{bmatrix}$$ $$
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.1.32)
 * }

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

$$ \mathbf{F^{1}}=\mathbf{L^{1^{T}}}.\mathbf{f^{1}} $$
 * style="width:95%" |
 * style="width:95%" |
 * }

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

$$\mathbf{F^{1}}=\begin{bmatrix} 1 & 0 & 0\\ 0 & 1 & 0\\ 0 & 0 & 1\\ 0 & 0 & 0\\ 0 & 0 & 0 \end{bmatrix}\begin{bmatrix} 0\\ 0.416667\\ 0.208333 \end{bmatrix} $$ <span id="(1)">
 * style="width:95%" |
 * style="width:95%" |
 * }
 * {| style="width:100%" border="0"


 * style="width:95%" |
 * style="width:95%" |

$$ \Rightarrow \mathbf{F^{1}}=\begin{bmatrix} 0\\ 0.416667\\ 0.208333\\ 0\\ 0 \end{bmatrix} $$ $$
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.1.33)
 * }

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


 * style="width:95%" |
 * style="width:95%" |

Ist Basis Function: $$b_{1}^{(2)}=\frac{(x-x_{4}).(x-x_{5})}{(x_{3}-x_{4}).(x_{3}-x_{5})}=\frac{(x-0.75).(x-1)}{(0.5-0.75).(0.5-1)}=8x^{2}-14x+6 $$

$$
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.1.34)
 * }

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


 * style="width:95%" |
 * style="width:95%" |

IInd Basis Function: $$b_{2}^{(2)}=\frac{(x-x_{3}).(x-x_{5})}{(x_{4}-x_{3}).(x_{4}-x_{5})}=\frac{(x-0.5).(x-1)}{(0.75-0.5).(0.75-1)}=-16x^{2}+24x-8 $$

$$ <span id="(1)">
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.1.35)
 * }
 * {| style="width:100%" border="0"


 * style="width:95%" |
 * style="width:95%" |

IIIrd Basis Function : $$b_{3}^{(2)}=\frac{(x-x_{3}).(x-x_{4})}{(x_{5}-x_{3}).(x_{5}-x_{4})}=\frac{(x-0.5).(x-0.75)}{(1-0.5).(1-0.75)}=8x^{2}-10x+3 $$

$$ <span id="(1)">
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.1.36)
 * }
 * {| style="width:100%" border="0"


 * style="width:95%" |
 * style="width:95%" |

$${b_{1}^{(2)}}'=16x-14, \quad\quad {b_{2}^{(2)}}'=-32x+24 , \quad\quad {b_{3}^{(2)}}'=16x-10 $$

$$
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.1.37)
 * }

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


 * style="width:95%" |
 * style="width:95%" |

As we know from the definition of K matrix <span id="(1)">
 * }
 * {| style="width:100%" border="0"

$$ \mathbf{K_{ij}^{(2)}}=\int_{\alpha }^{\beta }{b_{i}^{(2)}}'.a_{2}.{b_{j}^{(2)}}'dx $$
 * style="width:95%" |
 * style="width:95%" |

$$ <span id="(1)">
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.1.38)
 * }
 * {| style="width:100%" border="0"

So, the elements of local k matrix (for Element 2) are:
 * style="width:95%" |
 * style="width:95%" |
 * }

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

$$ \mathbf{k_{11}^{(2)}}=\int_{0.5 }^{1 }(16x-14).(2+3x).(16x-14)dx=17.8333 $$ $$ <span id="(1)">
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.1.39)
 * }
 * {| style="width:100%" border="0"

$$ \mathbf{k_{12}^{(2)}}=\mathbf{k_{21}^{(2)}}=\int_{0.5 }^{1}(16x-14).(2+3x).(-32x+24)dx=-20.6667 $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.1.40)
 * }

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

$$ \mathbf{k_{13}^{(2)}}=\mathbf{k_{31}^{(2)}}=\int_{0.5 }^{1}(16x-14).(2+3x).(16x-10)dx=2.83333 $$ $$ <span id="(1)">
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.1.41)
 * }
 * {| style="width:100%" border="0"

$$ \mathbf{k_{22}^{(2)}}=\int_{0.5 }^{1}(-32x+24).(2+3x).(-32x+24)dx=45.3333 $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.1.42)
 * }

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

$$ \mathbf{k_{23}^{(2)}}=\int_{0.5 }^{1 }(-32x+24).(2+3x).(16x-10)dx=-24.6667 $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.1.42)
 * }

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

$$ \mathbf{k_{33}^{(2)}}=\int_{0.5 }^{1}(16x-10).(2+3x).(16x-10)dx=21.83333 $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.1.43)
 * }

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

S0, the Element Stiffness Matrix or Local Stiffness Matrix for the Element 2 is :
 * style="width:95%" |
 * style="width:95%" |
 * }

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


 * style="width:95%" |
 * style="width:95%" |

$$ \mathbf{k^{(2)}}=\begin{bmatrix} 17.8333 & -20.6667 & 2.83333 \\ -20.6667 & 45.3333 & -24.6667 \\ 2.83333 & -24.6667  & 21.83333 \end{bmatrix}

$$ $$
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.1.44)
 * }

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

As we know from the definition of weak form the Force Matrix is given by:
 * style="width:95%" |
 * style="width:95%" |
 * }

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

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

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

So, the elements of force matrix are: <span id="(1)">
 * style="width:95%" |
 * style="width:95%" |
 * }
 * {| style="width:100%" border="0"

$$ f_{1}^{(2)}=\int_{0.5}^{1}(8x^{2}-14x+6).(5x)dx=0.28333 $$
 * style="width:95%" |
 * style="width:95%" |
 * }

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

$$ f_{2}^{(2)}=\int_{0.5}^{1}(-16x^{2}+24x-8).(5x)dx=1.25 $$
 * style="width:95%" |
 * style="width:95%" |
 * }

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

$$ f_{3}^{(2)}=(1).(12)\int_{0.5}^{1}(8x^{2}-10x+3).(5x)dx=12.416667 $$
 * style="width:95%" |
 * style="width:95%" |
 * }

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

So, the Element Force Matrix for Element 2 is:
 * style="width:95%" |
 * style="width:95%" |
 * }

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


 * style="width:95%" |
 * style="width:95%" |

$$ \mathbf{f^{(2)}}=\begin{bmatrix} 0.208333\\ 1.25\\ 12.416667 \end{bmatrix} $$ $$
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.1.46)
 * }

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

The transformation from Local to Global is given by: <span id="(1)">
 * style="width:95%" |
 * style="width:95%" |
 * }
 * {| style="width:100%" border="0"


 * style="width:95%" |
 * style="width:95%" |

Global K,F matrices For Element 2
So, the global K and F matrices for Element 2 are given as:
 * }

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

$$ \mathbf{K^{(e)}}= \mathbf{L^{(e)^{T}}}.\mathbf{k^{(e)}}.\mathbf{L^{(e)}} $$ $$ <span id="(1)">
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.1.47)
 * }
 * {| style="width:100%" border="0"

$$ \mathbf{F^{(e)}}=\mathbf{L^{(e)^{T}}}.\mathbf{f^{(e)}} $$ $$ <span id="(1)">
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.1.48)
 * }
 * {| style="width:100%" border="0"

For Element 2 $$ \mathbf{L^{(e)}}=\mathbf{L^{(2)}} $$.
 * style="width:95%" |
 * style="width:95%" |
 * }

$$ \mathbf{L^{(e)}} $$ For Element 2
<span id="(1)">
 * {| style="width:100%" border="0"


 * style="width:95%" |
 * style="width:95%" |

$$ \mathbf{L^{(2)}}=\begin{bmatrix} 0 &0 &1  &0  &0 \\ 0 &0  &0  &1  &0 \\ 0 &0  &0  &0  &1 \end{bmatrix} $$ $$
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.1.49)
 * }

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

$$ \mathbf{K^{(2)}}= \mathbf{L^{(2)^{T}}}.\mathbf{k^{(2)}}.\mathbf{L^{(2)}} $$
 * style="width:95%" |
 * style="width:95%" |
 * }

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

$$\mathbf{K^{(2)}}=\begin{bmatrix} 0 & 0 & 0\\ 0 & 0 & 0\\ 1 & 0 & 0\\ 0 & 1 & 0\\ 0 & 0 & 1 \end{bmatrix}\begin{bmatrix} 17.8333 & -20.6667 & 2.83333 \\ -20.6667 & 45.3333 & -24.6667 \\ 2.83333 & -24.6667  & 21.83333 \end{bmatrix}\begin{bmatrix} 0 &0 &1  &0  &0 \\ 0 &0  &0  &1  &0 \\ 0 &0  &0  &0  &1 \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }

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


 * style="width:95%" |
 * style="width:95%" |

$$ \Rightarrow \mathbf{K^{(2)}}=\begin{bmatrix} 0 &0 &0   &0  &0 \\ 0 &0  &0   &0  &0 \\ 0 &0  & 17.83333 &-20.6667  &2.83333 \\ 0 &0  &-20.6667  &45.3333  &-24.6667 \\ 0 &0  &2.83333  &-24.6667  &21.83333 \end{bmatrix}$$ $$
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.1.50)
 * }

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

$$ \mathbf{F^{(2)}}=\mathbf{L^{(2)^{T}}}.\mathbf{f^{(2)}} $$
 * style="width:95%" |
 * style="width:95%" |
 * }

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

$$\mathbf{F^{(2)}}=\begin{bmatrix} 0 & 0 & 0\\ 0 & 0 & 0\\ 1 & 0 & 0\\ 0 & 1 & 0\\ 0 & 0 & 1 \end{bmatrix}\begin{bmatrix} 0.208333\\ 1.25\\ 12.46667 \end{bmatrix} $$ <span id="(1)">
 * style="width:95%" |
 * style="width:95%" |
 * }
 * {| style="width:100%" border="0"


 * style="width:95%" |
 * style="width:95%" |

$$ \Rightarrow \mathbf{F^{(2)}}=\begin{bmatrix} 0\\ 0\\ 0.208333\\ 1.25\\ 12.46667 \end{bmatrix} $$ $$
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.1.51)
 * }

Global K matrix for 2 elements
<span id="(1)">
 * {| style="width:100%" border="0"

The Global K matrix for 2 elements is given by: <span id="(1)">
 * style="width:95%" |
 * style="width:95%" |
 * }
 * {| style="width:100%" border="0"

$$ \mathbf{\tilde{K}}=\sum_{e=1}^{2}\mathbf{K^{e}} $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.1.52)
 * }

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

$$ \Rightarrow \mathbf{\tilde{K}}=\mathbf{\tilde{K}^{(1)}}+\mathbf{\tilde{K}^{(2)}} $$
 * style="width:95%" |
 * style="width:95%" |
 * }

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

$$ \Rightarrow \tilde{K}=\begin{bmatrix} 10.8333 &-12.6667 &1.8333    &0  &0 \\ -12.667 &29.33333  &-16.6667  &0  &0 \\ 1.83333 &-16.6667  & 32.6666 &-20.6667  &2.83333 \\ 0 &0  &-20.6667  &45.3333  &-24.6667 \\ 0 &0  &2.83333  &-24.6667  &21.83333 \end{bmatrix} $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.1.53)
 * }

Global F matrix for 2 elements
<span id="(1)">
 * {| style="width:100%" border="0"

The Global F matrix for 2 elements is given by: <span id="(1)">
 * style="width:95%" |
 * style="width:95%" |
 * }
 * {| style="width:100%" border="0"

$$ \mathbf{\tilde{F}}=\sum_{e=1}^{2}\mathbf{F^{e}} $$ $$ <span id="(1)">
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.1.54)
 * }
 * {| style="width:100%" border="0"

$$ \Rightarrow \mathbf{\tilde{F}}=\mathbf{\tilde{F}^{(1)}}+\mathbf{\tilde{F}^{(2)}} $$
 * style="width:95%" |
 * style="width:95%" |
 * }

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

$$ \Rightarrow \tilde{F}=\begin{bmatrix} 0\\ 0.416667\\ 0.416667\\ 1.25\\ 12.41667 \end{bmatrix} $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.1.55)
 * }

Global d matrix for 2 elements
<span id="(1)">
 * {| style="width:100%" border="0"

As we know, <span id="(1)">
 * style="width:95%" |
 * style="width:95%" |
 * }
 * {| style="width:100%" border="0"

$$ \mathbf{\tilde{K}}.\mathbf{\tilde{d}}=\mathbf{\tilde{F}} $$ <span id="(1)">
 * style="width:95%" |
 * style="width:95%" |
 * }
 * {| style="width:100%" border="0"

$$\Rightarrow \mathbf{\tilde{d}}=\mathbf{\tilde{K}^{-1}}.\mathbf{\tilde{F}} $$ <span id="(1)">
 * style="width:95%" |
 * style="width:95%" |
 * }
 * {| style="width:100%" border="0"

So. the $$ \mathbf{\tilde{d}} $$ is :
 * style="width:95%" |
 * style="width:95%" |
 * }

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

$$ \mathbf{\tilde{d}}=\begin{bmatrix} 4\\ 5.5312\\ 6.6698\\ 7.5446\\ 8.2268 \end{bmatrix} $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.1.56)
 * }

At $$ x = 0.5 \quad $$ ,

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

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

The exact solution can be found from the eqn. 6.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 $$ no. \quad of \quad elements \quad (n) = 2 $$ is ,

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

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

MATLAB code with output
The K,d and F matrix for 2 elements only are as follows:

K =

10.8333 -12.6667    1.8333         0         0  -12.6667   29.3333  -16.6667         0         0    1.8333  -16.6667   32.6667  -20.6667    2.8333         0         0  -20.6667   45.3333  -24.6667         0         0    2.8333  -24.6667   21.8333

F =

[0   0.416666666666667    0.416666666666667    1.25000000000000    12.416666666666667]^T

d =

[4   5.53116172316385     6.66984463276837     7.54458967938842     8.22680850223224]^T

The outputs for convergence are as follows:

@x=0.5 Exact U=6.671156e+000

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

Error at n=2 is 1.311013e-003

@x=0.5 Exact U=6.671156e+000

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

Error at n=4 is 1.003161e-004

@x=0.5 Exact U=6.671156e+000

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

Error at n=6 is 2.076369e-005

@x=0.5 Exact U=6.671156e+000

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

Error at n=8 is 6.685488e-006

@x=0.5 Exact U=6.671156e+000

U(weak form) for n=10 = 6.671153e+000

Error at n=10 is 2.761216e-006

@x=0.5 Exact U=6.671156e+000

U(weak form) for n=12 = 6.671154e+000

Error at n=12 is 1.337704e-006

@x=0.5 Exact U=6.671156e+000

U(weak form) for n=14 = 6.671155e+000

Error at n=14 is 7.240625e-007

u,u^h vs n Plot
Eml5526.s11.team5.Dahiya 16:45, 6 April 2011 (UTC)

u,u^h vs x Plot
Eml5526.s11.team5.Dahiya 16:43, 6 April 2011 (UTC)

= 6.2 [ Solving G1DM1.0/D1 using weak form with QLEBF (Quadratic Lagrangian Element Basis Functions)] =

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. 6.2.1)
 * }

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

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

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

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

Find: Approximate solution using weak form and its comparison to exact solution
 Find approximate solution using weak form and compare it to exact one


 * Consider QLEBF basis function satisfying constraint basis solution


 * 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. 6.2.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. 6.2.5)
 * }

Boundary conditions

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

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

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

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

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

Differentiating 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. 6.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. 6.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. 6.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. 6.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. 6.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. 6.2.13)
 * }

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

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

Finding of the Approximate Solution using Weak form with QLEBF
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. 6.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. 6.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. 6.2.17)
 * }

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


 * style="width:95%" |
 * style="width:95%" |

Ist Basis Function: $$b_{1}^{(1)}=L_{1,3}=\frac{(x-x_{2}).(x-x_{3})}{(x_{1}-x_{2}).(x_{1}-x_{3})}=\frac{(x-0.25).(x-0.5)}{(0-0.25).(0-0.5)}=8x^{2}-6x+1 $$

$$
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.2.18)
 * }

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


 * style="width:95%" |
 * style="width:95%" |

IInd Basis Function: $$b_{2}^{(1)}=L_{2,3}=\frac{(x-x_{1}).(x-x_{3})}{(x_{2}-x_{1}).(x_{2}-x_{3})}=\frac{(x-0).(x-0.5)}{(0.25-0).(0.25-0.5)}=-16x^{2}+8x $$

$$ <span id="(1)">
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.2.19)
 * }
 * {| style="width:100%" border="0"


 * style="width:95%" |
 * style="width:95%" |

IIIrd Basis Function : $$b_{3}^{(1)}=L_{3,3}=\frac{(x-x_{1}).(x-x_{2})}{(x_{3}-x_{1}).(x_{3}-x_{2})}=\frac{(x-0).(x-0.25)}{(0.5-0).(0.5-0.25)}=8x^{2}-2x $$

$$ <span id="(1)">
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.2.20)
 * }
 * {| style="width:100%" border="0"


 * style="width:95%" |
 * style="width:95%" |

$${b_{1}^{(1)}}'=16x-6, \quad\quad {b_{2}^{(1)}}'=-32x+8 , \quad\quad {b_{3}^{(1)}}'=16x-2 $$

$$
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.2.21)
 * }

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


 * style="width:95%" |
 * style="width:95%" |

As we know from the definition of K matrix <span id="(1)">
 * }
 * {| style="width:100%" border="0"

$$ \mathbf{K_{ij}^{(1)}}=\int_{\alpha }^{\beta }{b_{i}^{(1)}}'.a_{2}.{b_{j}^{(1)}}'dx $$
 * style="width:95%" |
 * style="width:95%" |

$$ <span id="(1)">
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.2.21)
 * }
 * {| style="width:100%" border="0"

So, the elements of K matrix are:
 * style="width:95%" |
 * style="width:95%" |
 * }

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

$$ \mathbf{K_{11}^{(1)}}=\int_{0 }^{0.5 }(16x-6).(2+3x).(16x-6)dx=10.8333 $$ $$ <span id="(1)">
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.2.21)
 * }
 * {| style="width:100%" border="0"

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

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

$$ \mathbf{K_{13}^{1}}=\mathbf{K_{31}^{(1)}}=\int_{0 }^{0.5 }(16x-6).(2+3x).(16x-2)dx=1.83333 $$ $$ <span id="(1)">
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.2.23)
 * }
 * {| style="width:100%" border="0"

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

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

$$ \mathbf{K_{23}^{(1)}}=\int_{0 }^{0.5 }(-32x+8).(2+3x).(16x-2)dx=-16.6667 $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.2.25)
 * }

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

$$ \mathbf{K_{33}^{(1)}}=\int_{0 }^{0.5 }(16x-2).(2+3x).(16x-2)dx=14.83333 $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.2.26)
 * }

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

S0, the Element Stiffness Matrix or Local Stiffness Matrix for the Element 1 is :
 * style="width:95%" |
 * style="width:95%" |
 * }

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


 * style="width:95%" |
 * style="width:95%" |

$$ \mathbf{k^{(1)}}=\begin{bmatrix} 10.8333 & -12.6667 & 1.83333 \\ -12.6667 & 29.3333 & -16.6667 \\ 1.83333 & -16.6667  & 14.83333 \end{bmatrix}

$$ $$
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.2.27)
 * }

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

As we know from the definition of weak form the Force Matrix is given by:
 * style="width:95%" |
 * style="width:95%" |
 * }

<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. 6.2.28)
 * }

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

So, the elements of force matrix are: <span id="(1)">
 * style="width:95%" |
 * style="width:95%" |
 * }
 * {| style="width:100%" border="0"

$$ f_{1}^{(1)}=(1).(12)+\int_{0}^{0.5}(8x^{2}-6x+1).(5x)dx=12 $$
 * style="width:95%" |
 * style="width:95%" |
 * }

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

$$ f_{2}^{(1)}=\int_{0}^{0.5}(-16x^{2}+8x).(5x)dx=0.416667 $$
 * style="width:95%" |
 * style="width:95%" |
 * }

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

$$ f_{3}^{(1)}=\int_{0}^{0.5}(8x^{2}-2x).(5x)dx=0.2083333 $$
 * style="width:95%" |
 * style="width:95%" |
 * }

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

So, the Element Force Matrix for Element 1 is:
 * style="width:95%" |
 * style="width:95%" |
 * }

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


 * style="width:95%" |
 * style="width:95%" |

$$ \mathbf{f^{(1)}}=\begin{bmatrix} 12\\ 0.416667\\ 0.208333 \end{bmatrix} $$ $$
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.2.29)
 * }

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

The transformation from Local to Global is given by: <span id="(1)">
 * style="width:95%" |
 * style="width:95%" |
 * }
 * {| style="width:100%" border="0"

So, the global K and F matrices for Element 1 are given as:
 * style="width:95%" |
 * style="width:95%" |
 * }

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

$$ \mathbf{K^{e}}= \mathbf{L^{e^{T}}}.\mathbf{k^{e}}.\mathbf{L^{e}} $$ $$ <span id="(1)">
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.2.30)
 * }
 * {| style="width:100%" border="0"

$$ \mathbf{F^{e}}=\mathbf{L^{e^{T}}}.\mathbf{f^{e}} $$ $$ <span id="(1)">
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.2.31)
 * }
 * {| style="width:100%" border="0"

For Element 1 $$ \mathbf{L^{e}}=\mathbf{L^{1}} $$.
 * style="width:95%" |
 * style="width:95%" |
 * }

$$ \mathbf{L^{e}} \quad $$ For Element 1
<span id="(1)">
 * {| style="width:100%" border="0"

$$ \mathbf{L^{1}}=\begin{bmatrix} 1 &0 &0  &0  &0 \\ 0 &1  &0  &0  &0 \\ 0 &0  &1  &0  &0 \end{bmatrix} $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.2.32)
 * }

Global K,F matrices For Element 1
<span id="(1)">
 * {| style="width:100%" border="0"

$$ \mathbf{K^{1}}= \mathbf{L^{1^{T}}}.\mathbf{k^{1}}.\mathbf{L^{1}} $$
 * style="width:95%" |
 * style="width:95%" |
 * }

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

$$\mathbf{K^{1}}=\begin{bmatrix} 1 & 0 & 0\\ 0 & 1 & 0\\ 0 & 0 & 1\\ 0 & 0 & 0\\ 0 & 0 & 0 \end{bmatrix}\begin{bmatrix} 10.8333 & -12.6667 & 1.83333 \\ -12.6667 & 29.3333 & -16.6667 \\ 1.83333 & -16.6667  & 14.83333 \end{bmatrix}\begin{bmatrix} 1 &0 &0  &0  &0 \\ 0 &1  &0  &0  &0 \\ 0 &0  &1  &0  &0 \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }

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


 * style="width:95%" |
 * style="width:95%" |

$$ \Rightarrow \mathbf{K^{1}}=\begin{bmatrix} 10.8333 &-12.6667 &1.8333    &0  &0 \\ -12.667 &29.33333  &-16.6667  &0  &0 \\ 1.8333  & -16.6667 & 14.83333 &0  &0 \\ 0 &0  &0  &0  &0 \\ 0 &0  &0  &0  &0 \end{bmatrix}$$ $$
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.2.32)
 * }

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

$$ \mathbf{F^{1}}=\mathbf{L^{1^{T}}}.\mathbf{f^{1}} $$
 * style="width:95%" |
 * style="width:95%" |
 * }

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

$$\mathbf{F^{1}}=\begin{bmatrix} 1 & 0 & 0\\ 0 & 1 & 0\\ 0 & 0 & 1\\ 0 & 0 & 0\\ 0 & 0 & 0 \end{bmatrix}\begin{bmatrix} 12\\ 0.416667\\ 0.208333 \end{bmatrix} $$ <span id="(1)">
 * style="width:95%" |
 * style="width:95%" |
 * }
 * {| style="width:100%" border="0"


 * style="width:95%" |
 * style="width:95%" |

$$ \Rightarrow \mathbf{F^{1}}=\begin{bmatrix} 12\\ 0.416667\\ 0.208333\\ 0\\ 0 \end{bmatrix} $$ $$
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.2.33)
 * }

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


 * style="width:95%" |
 * style="width:95%" |

Ist Basis Function: $$b_{1}^{(2)}=\frac{(x-x_{4}).(x-x_{5})}{(x_{3}-x_{4}).(x_{3}-x_{5})}=\frac{(x-0.75).(x-1)}{(0.5-0.75).(0.5-1)}=8x^{2}-14x+6 $$

$$
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.2.34)
 * }

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


 * style="width:95%" |
 * style="width:95%" |

IInd Basis Function: $$b_{2}^{(2)}=\frac{(x-x_{3}).(x-x_{5})}{(x_{4}-x_{3}).(x_{4}-x_{5})}=\frac{(x-0.5).(x-1)}{(0.75-0.5).(0.75-1)}=-16x^{2}+24x-8 $$

$$ <span id="(1)">
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.2.35)
 * }
 * {| style="width:100%" border="0"


 * style="width:95%" |
 * style="width:95%" |

IIIrd Basis Function : $$b_{3}^{(2)}=\frac{(x-x_{3}).(x-x_{4})}{(x_{5}-x_{3}).(x_{5}-x_{4})}=\frac{(x-0.5).(x-0.75)}{(1-0.5).(1-0.75)}=8x^{2}-10x+3 $$

$$ <span id="(1)">
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.2.36)
 * }
 * {| style="width:100%" border="0"


 * style="width:95%" |
 * style="width:95%" |

$${b_{1}^{(2)}}'=16x-14, \quad\quad {b_{2}^{(2)}}'=-32x+24 , \quad\quad {b_{3}^{(2)}}'=16x-10 $$

$$
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.2.37)
 * }

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


 * style="width:95%" |
 * style="width:95%" |

As we know from the definition of K matrix <span id="(1)">
 * }
 * {| style="width:100%" border="0"

$$ \mathbf{K_{ij}^{(2)}}=\int_{\alpha }^{\beta }{b_{i}^{(2)}}'.a_{2}.{b_{j}^{(2)}}'dx $$
 * style="width:95%" |
 * style="width:95%" |

$$ <span id="(1)">
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.2.38)
 * }
 * {| style="width:100%" border="0"

So, the elements of local k matrix (for Element 2) are:
 * style="width:95%" |
 * style="width:95%" |
 * }

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

$$ \mathbf{k_{11}^{(2)}}=\int_{0.5 }^{1 }(16x-14).(2+3x).(16x-14)dx=17.8333 $$ $$ <span id="(1)">
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.2.39)
 * }
 * {| style="width:100%" border="0"

$$ \mathbf{k_{12}^{(2)}}=\mathbf{k_{21}^{(2)}}=\int_{0.5 }^{1}(16x-14).(2+3x).(-32x+24)dx=-20.6667 $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.2.40)
 * }

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

$$ \mathbf{k_{13}^{(2)}}=\mathbf{k_{31}^{(2)}}=\int_{0.5 }^{1}(16x-14).(2+3x).(16x-10)dx=2.83333 $$ $$ <span id="(1)">
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.2.41)
 * }
 * {| style="width:100%" border="0"

$$ \mathbf{k_{22}^{(2)}}=\int_{0.5 }^{1}(-32x+24).(2+3x).(-32x+24)dx=45.3333 $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.2.42)
 * }

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

$$ \mathbf{k_{23}^{(2)}}=\int_{0.5 }^{1 }(-32x+24).(2+3x).(16x-10)dx=-24.6667 $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.2.42)
 * }

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

$$ \mathbf{k_{33}^{(2)}}=\int_{0.5 }^{1}(16x-10).(2+3x).(16x-10)dx=21.83333 $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.2.43)
 * }

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

S0, the Element Stiffness Matrix or Local Stiffness Matrix for the Element 2 is :
 * style="width:95%" |
 * style="width:95%" |
 * }

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


 * style="width:95%" |
 * style="width:95%" |

$$ \mathbf{k^{(2)}}=\begin{bmatrix} 17.8333 & -20.6667 & 2.83333 \\ -20.6667 & 45.3333 & -24.6667 \\ 2.83333 & -24.6667  & 21.83333 \end{bmatrix}

$$ $$ 2
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.2.44)
 * }

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

As we know from the definition of weak form the Force Matrix is given by:
 * style="width:95%" |
 * style="width:95%" |
 * }

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

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

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

So, the elements of force matrix are: <span id="(1)">
 * style="width:95%" |
 * style="width:95%" |
 * }
 * {| style="width:100%" border="0"

$$ f_{1}^{(2)}=\int_{0.5}^{1}(8x^{2}-14x+6).(5x)dx=0.28333 $$
 * style="width:95%" |
 * style="width:95%" |
 * }

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

$$ f_{2}^{(2)}=\int_{0.5}^{1}(-16x^{2}+24x-8).(5x)dx=1.25 $$
 * style="width:95%" |
 * style="width:95%" |
 * }

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

$$ f_{3}^{(2)}=\int_{0.5}^{1}(8x^{2}-10x+3).(5x)dx=0.416667 $$
 * style="width:95%" |
 * style="width:95%" |
 * }

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

So, the Element Force Matrix for Element 2 is:
 * style="width:95%" |
 * style="width:95%" |
 * }

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


 * style="width:95%" |
 * style="width:95%" |

$$ \mathbf{f^{(2)}}=\begin{bmatrix} 0.208333\\ 1.25\\ 0.416667 \end{bmatrix} $$ $$
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.2.46)
 * }

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

The transformation from Local to Global is given by: <span id="(1)">
 * style="width:95%" |
 * style="width:95%" |
 * }
 * {| style="width:100%" border="0"


 * style="width:95%" |
 * style="width:95%" |

Global K,F matrices For Element 2
So, the global K and F matrices for Element 2 are given as:
 * }

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

$$ \mathbf{K^{(e)}}= \mathbf{L^{(e)^{T}}}.\mathbf{k^{(e)}}.\mathbf{L^{(e)}} $$ $$ <span id="(1)">
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.2.47)
 * }
 * {| style="width:100%" border="0"

$$ \mathbf{F^{(e)}}=\mathbf{L^{(e)^{T}}}.\mathbf{f^{(e)}} $$ $$ <span id="(1)">
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.2.48)
 * }
 * {| style="width:100%" border="0"

For Element 2 $$ \mathbf{L^{(e)}}=\mathbf{L^{(2)}} $$.
 * style="width:95%" |
 * style="width:95%" |
 * }

$$ \mathbf{L^{(e)}} $$ For Element 2
<span id="(1)">
 * {| style="width:100%" border="0"


 * style="width:95%" |
 * style="width:95%" |

$$ \mathbf{L^{(2)}}=\begin{bmatrix} 0 &0 &1  &0  &0 \\ 0 &0  &0  &1  &0 \\ 0 &0  &0  &0  &1 \end{bmatrix} $$ $$
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.2.49)
 * }

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

$$ \mathbf{K^{(2)}}= \mathbf{L^{(2)^{T}}}.\mathbf{k^{(2)}}.\mathbf{L^{(2)}} $$
 * style="width:95%" |
 * style="width:95%" |
 * }

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

$$\mathbf{K^{(2)}}=\begin{bmatrix} 0 & 0 & 0\\ 0 & 0 & 0\\ 1 & 0 & 0\\ 0 & 1 & 0\\ 0 & 0 & 1 \end{bmatrix}\begin{bmatrix} 17.8333 & -20.6667 & 2.83333 \\ -20.6667 & 45.3333 & -24.6667 \\ 2.83333 & -24.6667  & 21.83333 \end{bmatrix}\begin{bmatrix} 0 &0 &1  &0  &0 \\ 0 &0  &0  &1  &0 \\ 0 &0  &0  &0  &1 \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }

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


 * style="width:95%" |
 * style="width:95%" |

$$ \Rightarrow \mathbf{K^{(2)}}=\begin{bmatrix} 0 &0 &0   &0  &0 \\ 0 &0  &0   &0  &0 \\ 0 &0  & 17.83333 &-20.6667  &2.83333 \\ 0 &0  &-20.6667  &45.3333  &-24.6667 \\ 0 &0  &2.83333  &-24.6667  &21.83333 \end{bmatrix}$$ $$
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.2.50)
 * }

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

$$ \mathbf{F^{(2)}}=\mathbf{L^{(2)^{T}}}.\mathbf{f^{(2)}} $$
 * style="width:95%" |
 * style="width:95%" |
 * }

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

$$\mathbf{F^{(2)}}=\begin{bmatrix} 0 & 0 & 0\\ 0 & 0 & 0\\ 1 & 0 & 0\\ 0 & 1 & 0\\ 0 & 0 & 1 \end{bmatrix}\begin{bmatrix} 0.208333\\ 1.25\\ 0.416667 \end{bmatrix} $$ <span id="(1)">
 * style="width:95%" |
 * style="width:95%" |
 * }
 * {| style="width:100%" border="0"


 * style="width:95%" |
 * style="width:95%" |

$$ \Rightarrow \mathbf{F^{(2)}}=\begin{bmatrix} 0\\ 0\\ 0.208333\\ 1.25\\ 0.416667 \end{bmatrix} $$ $$
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.2.51)
 * }

Global K matrix for 2 elements
<span id="(1)">
 * {| style="width:100%" border="0"

The Global K matrix for 2 elements is given by: <span id="(1)">
 * style="width:95%" |
 * style="width:95%" |
 * }
 * {| style="width:100%" border="0"

$$ \mathbf{\tilde{K}}=\sum_{e=1}^{2}\mathbf{K^{e}} $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.2.52)
 * }

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

$$ \Rightarrow \mathbf{\tilde{K}}=\mathbf{\tilde{K}^{(1)}}+\mathbf{\tilde{K}^{(2)}} $$
 * style="width:95%" |
 * style="width:95%" |
 * }

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

$$ \Rightarrow \tilde{K}=\begin{bmatrix} 10.8333 &-12.6667 &1.8333    &0  &0 \\ -12.667 &29.33333  &-16.6667  &0  &0 \\ 1.83333 &-16.6667  & 32.6666 &-20.6667  &2.83333 \\ 0 &0  &-20.6667  &45.3333  &-24.6667 \\ 0 &0  &2.83333  &-24.6667  &21.83333 \end{bmatrix} $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.2.53)
 * }

Global F matrix for 2 elements
<span id="(1)">
 * {| style="width:100%" border="0"

The Global F matrix for 2 elements is given by: <span id="(1)">
 * style="width:95%" |
 * style="width:95%" |
 * }
 * {| style="width:100%" border="0"

$$ \mathbf{\tilde{F}}=\sum_{e=1}^{2}\mathbf{F^{e}} $$ $$ <span id="(1)">
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.2.54)
 * }
 * {| style="width:100%" border="0"

$$ \Rightarrow \mathbf{\tilde{F}}=\mathbf{\tilde{F}^{(1)}}+\mathbf{\tilde{F}^{(2)}} $$
 * style="width:95%" |
 * style="width:95%" |
 * }

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

$$ \Rightarrow \tilde{F}=\begin{bmatrix} 12\\ 0.416667\\ 0.416667\\ 1.25\\ 0.41667 \end{bmatrix} $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.2.55)
 * }

Global d matrix for 2 elements
<span id="(1)">
 * {| style="width:100%" border="0"

As we know, <span id="(1)">
 * style="width:95%" |
 * style="width:95%" |
 * }
 * {| style="width:100%" border="0"

$$ \mathbf{\tilde{K}}.\mathbf{\tilde{d}}=\mathbf{\tilde{F}} $$ <span id="(1)">
 * style="width:95%" |
 * style="width:95%" |
 * }
 * {| style="width:100%" border="0"

$$\Rightarrow \mathbf{\tilde{d}}=\mathbf{\tilde{K}^{-1}}.\mathbf{\tilde{F}} $$ <span id="(1)">
 * style="width:95%" |
 * style="width:95%" |
 * }
 * {| style="width:100%" border="0"

So. the $$ \mathbf{\tilde{d}} $$ is :
 * style="width:95%" |
 * style="width:95%" |
 * }

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

$$ \mathbf{\tilde{d}}=\begin{bmatrix} 7.8642\\ 6.5882\\ 5.5934\\ 4.7540\\ 4 \end{bmatrix} $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle                                                                          (Eq. 6.2.56)
 * }

At $$ x = 0.5 \quad $$ ,

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

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

The exact solution can be found from the eqn. 6.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 $$ no. \quad of \quad elements \quad (n) = 2 $$ is ,

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

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

MATLAB code with output
The K,d and F matrix for 2 elements are as follows:

K =

10.8333 -12.6667    1.8333         0         0  -12.6667   29.3333  -16.6667         0         0    1.8333  -16.6667   32.6667  -20.6667    2.8333         0         0  -20.6667   45.3333  -24.6667         0         0    2.8333  -24.6667   21.8333

F =

[12 0.416666666666667 0.416666666666667 1.25000000000000 0.416666666666667]^T

d =

[7.8642  6.5882   5.5934   4.7540   4]^T

The outputs for two elements are as follows:

@x=0.5 Exact U=5.593524e+000

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

Error at n=2 is 1.380272e-004

@x=0.5 Exact U=5.593524e+000

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

Error at n=4 is 9.391941e-006

@x=0.5 Exact U=5.593524e+000

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

Error at n=6 is 1.871865e-006

@x=0.5 Exact U=5.593524e+000

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

Error at n=8 is 5.817644e-007