User:Eml5526.s11.team2/topsecret3

=Problem 3.1: Solution to PDE/ODE Using Polynomial Basis Functions=

Given: A Polynomial Basis and a 2nd Order Formulation
Consider the polynomial basis of the form
 * {| style="width:100%" border="0"

$$ \displaystyle \{(x+k)^j \quad \bigg|\quad j=0,1,2 \cdots ,n\} $$     (1.0)
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }


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

$$  \displaystyle 2\frac{d^2u}{dx^2}+3=0 $$     (1.1)
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }

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

$$  \displaystyle u(x=1)=0 $$     (1.2)
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle -\frac{du}{dx}(x=0)=4 $$     (1.3)
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle b_j=(x+1)^j $$     (1.4) The exact solution to Eq.3.1:
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle u(x)=-\frac{3}{4}x^2-4x+\frac{19}{4} $$     (1.5)
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }

1. Find two equations that enforce the boundary conditions for

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

$$  \displaystyle u^h(x)=\sum_{i=0}^n d_ib_i $$     (1.6)
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }

2. Find One More Linearly Independent Equation
Find one more equation to solve for in $$ \displaystyle {d} = \{d_i \}_{3x1} $$ such that $$ \displaystyle (j=0,1,2)$$ by projecting the residue $$ \displaystyle P(u^h) $$ onto the given polynomial basis function $$ \displaystyle b_k(x) $$ such that the additional equation is linearly independent of the original two equations.

3. Display in Matrix Form
Display these three equations in the matrix form Is the matrix $$ \displaystyle \underline{\mathbf{K}} $$ symmetric?

4. Solve for d
Solve the system of linear equations given by $$ \displaystyle \underline{\mathbf{K}} \mathbf{d}=\mathbf{f} $$ for $$ \displaystyle \mathbf{d} $$.

5. Construct and Plot the Approximate and Exact Solution for u(x)
Construct $$ \displaystyle u^h(x) $$ and plot $$ \displaystyle u^h(x) $$ versus $$ \displaystyle u(x) $$.

1. Find two equations that enforce the boundary conditions for

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

$$  \displaystyle u^h(x)=\sum_{i=0}^n d_ib_i $$     (1.6) First let's expand Eq.3.6 out to n=2 terms.
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle u^h(x)=d_0b_0+d_1b_1+d_2b_2 $$     (1.7) Now consider Eq.3.4, and substitute the appropriate terms into Eq.3.7.
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle u^h(x)=d_0(1)+d_1(x+1)+d_2(x+1)^2 $$     (1.8) Let's rewrite this equation in terms of a product between 2 vectors.
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle u^h(x)=\left[1\quad x+1 \quad (x+1)^2\right ]\begin{bmatrix} d_0\\d_1\\d_2\end{bmatrix} $$     (1.9)
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }

In order for us to solve for the unknown $$d_i's$$ in Eq.3.9, we must have 3 linearly independent equations describing linear combinations of the $$d_i's.$$Two of the equations are easily obtained directly from the given boundary conditions in Eq.3.2 and Eq.3.3. It only makes practical sense that if we want our approximation to closely resemble our exact solution, we must require identical behavior between Eq.3.5 and Eq.3.8 at the boundaries.
 * {| style="width:100%" border="0"

$$  \displaystyle \begin{align} u^h(x=1)=d_0(1)+d_1(1+1)+d_2(1+1)^2&=0\\ d_0(1)+d_1(2)+d_2(2)^2&=0 \end{align} $$     (1.10)
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }


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

$$  \displaystyle \frac{du}{dx}(x=0)=d_1+d_22(0+1)=-4 $$     (1.12)
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }

2. Find One More Linearly Independent Equation
Now we just need one more linearly independent equation and we can then readily solve for the $$d_i's.$$ To develop another set of equations which are linearly independent of Eq.3.11 and Eq.3.13, we take the inner product between our approximation of u(x), Eq.3.9 and our basis set of functions Eq.3.4. Before getting to the inner product first, let's define our linear differential operator as the following
 * {| style="width:100%" border="0"

$$  \displaystyle P(\cdot)=\frac{d^2}{dx^2}+\frac{3}{2}=0 $$     (1.14) Now, using our operator in Eq.3.14, we can now operate on our approximation in Eq.3.9.
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle \begin{align} P(u^h)=\frac{d^2}{dx^2}\left[1\quad x+1\quad (x+1)^2\right ]\begin{bmatrix} d_0\\d_1\\d_2\end{bmatrix}+\frac{3}{2}&=0\\ \left[0\quad 0\quad 2\right ]\begin{bmatrix} d_0\\d_1\\d_2\end{bmatrix}+\frac{3}{2}&=0 \end{align} $$     (1.15) Which we can then rewrite Eq.3.15 as
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle \left[0\quad 0\quad 2\right ]\begin{bmatrix} d_0\\d_1\\d_2\end{bmatrix}=-\frac{3}{2} $$     (1.16) Now, we are in a position to take the inner product of Eq.3.16(our approximation) with the basis set in Eq.3.4 with $$ n=2.$$
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle \left \langle b_j, P(u^h) \right \rangle =\int_0^1b_jP(u^h)=0 $$     (1.17)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle \int_0^1\begin{bmatrix} 1\\x+1\\(x+1)^2\end{bmatrix} \left[0\quad 0\quad 2\right ]\,dx\begin{bmatrix} d_0\\d_1\\d_2\end{bmatrix}=-\frac{3}{2}\int_0^1\begin{bmatrix} 1\\x+1\\(x+1)^2\end{bmatrix}\,dx $$     (1.18)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


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

$$  \displaystyle \int_0^1\begin{bmatrix} 0&0&2\\0&0&2(x+1)\\0&0&2(x+1)^2\end{bmatrix}\,dx\begin{bmatrix} d_0\\d_1\\d_2\end{bmatrix}=-\frac{3}{2}\int_0^1\begin{bmatrix} 1\\x+1\\(x+1)^2\end{bmatrix}\,dx $$     (1.19)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle \begin{bmatrix} 0&0&2\\0&0&3\\0&0&14/3\end{bmatrix}\begin{bmatrix} d_0\\d_1\\d_2\end{bmatrix}=\begin{bmatrix} -3/2\\-9/4\\-7/2\end{bmatrix} $$     (1.20)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

3. Display in Matrix Form
Display these three equations in the matrix form shown below and determine if it is symmetric.

We can use any one of the above expressions as our $$3^{rd}$$ equation to solve for our unknown $$ a_i's$$, along with Eq.3.11 and Eq.3.13. Let's randomly just choose the $$3^{rd}$$row in Eq.3.20 as our $$3^{rd}$$ relationship and then, using Eq.3.11 and Eq.3.13, we can form the following matrix equation.
 * {| style="width:100%" border="0"

$$  \displaystyle \begin{bmatrix} 1&2&4\\0&1&2\\0&0&14/3\end{bmatrix}\begin{bmatrix} d_0\\d_1\\d_2\end{bmatrix}=\begin{bmatrix}0\\-4\\-7/2\end{bmatrix} $$     (1.21)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

4. Solve for d
Let's solve for the inverse of the matrix in Eq.3.21 using the Gauss-Jordan Method. Letting the matrix above in Eq.3.21 equal $$\underline{\mathbf{K}}$$, we can find $$\underline{\mathbf{K}}^{-1}$$ by
 * {| style="width:100%" border="0"

$$  \displaystyle \begin{align} \underline{\mathbf{K}}\cdot\underline{\mathbf{I}}&=\begin{bmatrix} 1&2&4&1&0&0\\0&1&2&0&1&0\\0&0&14/3&0&0&1\end{bmatrix}\\ &=\begin{bmatrix} 1&0&0&1&-2&0\\0&1&2&0&1&0\\0&0&14/3&0&0&1\end{bmatrix}\\ &=\begin{bmatrix} 1&0&0&1&-2&0\\0&1&0&0&1&-6/14\\0&0&14/3&0&0&1\end{bmatrix}\\ &=\begin{bmatrix} 1&0&0&1&-2&0\\0&1&0&0&1&-6/14\\0&0&1&0&0&3/14\end{bmatrix} \end{align} $$     (1.22)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

Now using Eq.3.23, we can solve Eq.3.21 for our unknown $$d_i's.$$
 * {| style="width:100%" border="0"

$$  \displaystyle \underline{\mathbf{K}}^{-1}\cdot \underline{\mathbf{K}}\begin{bmatrix} d_0\\d_1\\d_2\end{bmatrix}=\underline{\mathbf{K}}^{-1}\begin{bmatrix}0\\-4\\-7/2\end{bmatrix} $$     (1.24)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle \begin{bmatrix} d_0\\d_1\\d_2\end{bmatrix} = \begin{bmatrix}1&-2&0\\0&1&-6/14\\0&0&3/14\end{bmatrix}\begin{bmatrix}0\\-4\\7/2\end{bmatrix} $$     (1.25)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

Egm5526.s11.team-2.langpm 14:35, 14 February 2011 (UTC)

5. Construct and Plot the Approximate and Exact Solution for u(x)
Construct $$ \displaystyle u^h(x) $$ and plot $$ \displaystyle u^h(x) $$ versus $$ \displaystyle u(x). $$

Now. let's check the absolute error between our approximate solution above in Eq. 3.26 and our exact solution in Eq.3.5.
 * {| style="width:100%" border="0"

$$  \displaystyle \begin{align} \Delta \mathbf{E_{abs}}=u^h(x=0.5)-u(x=0.5) \end{align} $$     (1.28)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


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

$$  \displaystyle \begin{align} u^h(x=0.5)&=8-\frac{11}{2}(0.5+1)+\frac{3}{4}(0.5+1)^2\\ &=41/16 \end{align} $$     (1.29)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle \begin{align} u(x=0.5)&=-\frac{3}{4}(0.5)^2-4(0.5)+\frac{19}{4}\\ &=41/16 \end{align} $$     (1.30)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

Therefore, we can see from both the graph and the absolute error that our approximation in Eq.3.26 to the solution of the differential equation (Eq.3.1) gives the same results as our exact solution. Egm5526.s11.team-2.langpm 14:35, 14 February 2011 (UTC)

Graphical Comparison Between Exact and Approximate Solutions
Egm5526.s11.team-2.langpm 14:37, 14 February 2011 (UTC)

MATLAB Code for Case:n=2
Egm5526.s11.team-2.langpm 22:35, 14 February 2011 (UTC)

1. Find two equations that enforce the boundary conditions for

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

$$  \displaystyle u^h(x)=\sum_{i=0}^n d_ib_i $$     (1.6)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

We will follow exactly the same methodology as we have above, leaving out the explanations for each step.
 * {| style="width:100%" border="0"

$$  \displaystyle u^h(x)=d_0b_0+d_1b_1+d_2b_2+d_3b_3+d_4b_4 $$     (1.32)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle u^h(x)=d_0(1)+d_1(x+1)+d_2(x+1)^2+d_3(x+1)^3+d_4(x+1)^4 $$     (1.33)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle u^h(x)=\begin{bmatrix}1 & x+1 & (x+1)^2 & (x+1)^3 & (x+1)^4 \end{bmatrix}\begin{bmatrix}d_0\\d_1\\d_2\\d_3\\d_4 \end{bmatrix} $$     (1.34) Using our given boundary conditions to obtain our first 2 linearly independent equations.
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle \begin{align} u^h(x=1)&=d_0(1)+d_1(1+1)+d_2(1+1)^2+d_3(1+1)^3+d_4(1+1)^4\\ &=d_0(1)+2d_1+4d_2+8d_3+16d_4 \end{align} $$     (1.35)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


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

$$  \displaystyle \frac{du^h}{dx}(x=0)=d_1+2d_2+3d_3+4d_4 $$     (1.37)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

2. Find One More Linearly Independent Equation
Using our predefined linear differential operator in Eq.3.14.
 * {| style="width:100%" border="0"

$$  \displaystyle P(u^h)=\frac{d^2}{dx^2}\begin{bmatrix}1 & x+1 & (x+1)^2 & (x+1)^3 & (x+1)^4 \end{bmatrix}\begin{bmatrix}d_0\\d_1\\d_2\\d_3\\d_4 \end{bmatrix} + \frac{3}{2} $$     (1.39) Because this time we have 5 unknown $$d_i's,$$ we will have to choose 3 equations from our inner product operation.
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle \left \langle b_i,P(u^h) \right \rangle =\int_0^1b_iP(u^h)=0 $$     (1.40)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


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

$$  \displaystyle \int_0^1\begin{bmatrix}1\\x+1\\(x+1)^2\\(x+1)^3\\(x+1)^4\end{bmatrix}\begin{bmatrix}0 & 0 & 2 & 6(x+1) & 12(x+1)^2 \end{bmatrix}\,dx \begin{bmatrix}d_0\\d_1\\d_2\\d_3\\d_4\end{bmatrix}=-\frac{3}{2}\int_0^1\begin{bmatrix}1\\x+1\\(x+1)^2\\(x+1)^3\\(x+1)^4\end{bmatrix}\, dx $$ (1.41)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


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

$$  \displaystyle \int_0^1\begin{bmatrix} 0 & 0 & 2 & 6(x+1) & 12(x+1)^2\\ 0 & 0 & 2(x+1) & 6(x+1)^2 & 12(x+1)^3\\ 0 & 0 & 2(x + 1)^2 & 6(x+1)^3 & 12(x+1)^4\\ 0 & 0 & 2(x+1)^3 & 6(x+1)^4 & 12(x+1)^5\\ 0 & 0 & 2(x+1)^4 & 6(x+1)^5 & 12(x+1)^6 \end{bmatrix}\,dx \begin{bmatrix}d_0\\d_1\\d_2\\d_3\\d_4\end{bmatrix}=-\frac{3}{2}\int_0^1\begin{bmatrix}1\\x+1\\(x+1)^2\\(x+1)^3\\(x+1)^4\end{bmatrix}\, dx $$ (1.42)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


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

$$  \displaystyle \begin{bmatrix} 0 & 0 & 2 & 9 & 28\\ 0 & 0 & 3 & 14 & 45\\                                       0 & 0 & 14/3 & 45/2 & 372/5\\                                         0 & 0 & 15/2 & 186/5 & 126\\                                         0 & 0 & 62/5 & 63 & 1524/7 \end{bmatrix} \begin{bmatrix}d_0\\d_1\\d_2\\d_3\\d_4\end{bmatrix}=-\begin{bmatrix}3/2\\ 9/4 \\ 7/2 \\ 45/8 \\ 93/10 \end{bmatrix} $$     (1.43)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

3. Display in Matrix Form
Display these three equations in the matrix form shown below and determine if it is symmetric.

Now we can use the bottom three rows of Eq.3.43, along with Eq.3.36 and Eq.3.38 to develop a system of equations
 * {| style="width:100%" border="0"

$$  \displaystyle \begin{bmatrix} 1 & 2 & 4 & 8 & 16\\ 0 & 1 & 2 & 3 & 4\\                                       0 & 0 & 14/3 & 45/2 & 372/5\\                                         0 & 0 & 15/2 & 186/5 & 126\\                                         0 & 0 & 62/5 & 63 & 1524/7 \end{bmatrix} \begin{bmatrix}d_0\\d_1\\d_2\\d_3\\d_4\end{bmatrix}=-\begin{bmatrix} 0 \\ 4 \\ 7/2 \\ 45/8 \\ 93/10 \end{bmatrix} $$     (1.44)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

4. Solve for d
Using a MATLAB script which I wrote (the code is detailed below) to solve for the unknown $$d_i's$$ we can then solve for our approximate expression and see if we get better results than in the $$ n=2$$ case.


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

$$  \displaystyle \begin{bmatrix}d_0\\d_1\\d_2\\d_3\\d_4\end{bmatrix}=\begin{bmatrix} 8 \\ -5/2 \\ -3/4 \\ 0 \\ 0 \end{bmatrix} $$     (1.45) Egm5526.s11.team-2.langpm 14:37, 14 February 2011 (UTC)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

5. Construct and Plot the Approximate and Exact Solution for u(x)
We can see from above in Eq.3.46 that our solution did not improve at all by an increase in n from 2 to 4. Egm5526.s11.team-2.langpm 14:37, 14 February 2011 (UTC)

Graphical Comparison Between Exact and Approximate Solutions
Egm5526.s11.team-2.langpm 14:38, 14 February 2011 (UTC)

MATLAB Code n=4 Case
Egm5526.s11.team-2.langpm 22:35, 14 February 2011 (UTC)

1. Find two equations that enforce the boundary conditions for

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

$$  \displaystyle u^h(x)=\sum_{i=0}^n d_ib_i $$     (1.6)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle \begin{align} u^h(x) &= d_0b_0+d_1b_1+d_2b_2+d_3b_3+d_4b_4+d_5b_5+d_6b_6\\ &=d_0+d_1(x+1)+d_2(x+2)^2+d_3(x+1)^3+d_4(x+1)^4+d_5(x+1)^5+d_6(x+1)^6 \end{align} $$     (1.47) Using the given boundary conditions in Eq.3.2 and Eq.3.3 we have the following to restrictions on our approximated solution.
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle \begin{align} u^h(x=1)=&d_0+d_1(1+1)+d_2(1+1)^2+d_3(1+1)^3+d_4(1+1)^4+d_5(1+1)^5+d_6(1+1)^6=0\\ &d_0+2d_1+4d_2+8d_3+16d_4+32d_5+64d_6=0 \end{align} $$     (1.48)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


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

$$  \displaystyle \frac{du^h}{dx}(x=0)=d_1+2d_2+3d_3+4d_4+5d_5+6d_6=-4 $$     (1.50)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

2. Find One More Linearly Independent Equation
Using the same linear differential operator as we have for the past 2 cases, Eq.3.14 we have the following.
 * {| style="width:100%" border="0"

$$  \displaystyle P(u^h)=\frac{d^2}{dx^2}\begin{bmatrix} 1 & x+1 & (x+1)^2 & (x+1)^3 & (x+1)^4 & (x+1)^5 & (x+1)^6\end{bmatrix}\begin{bmatrix} d_0 \\ d_1 \\ d_2 \\ d_3 \\ d_4 \\ d_5 \\ d_6 \end{bmatrix} +\frac{3}{2} $$     (1.52) Forming the inner product.
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle \left \langle b_i,P(u^h) \right \rangle = \int_0^1 b_iP(u^h)\,dx = 0 $$     (1.53)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


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

$$  \displaystyle \int_0^1\begin{bmatrix} 0 & 0 & 2 & 6(x + 1) & 12(x + 1)^2 & 20(x + 1)^3 & 30(x + 1)^4\\ 0 & 0 & 2(x + 1) & 6(x + 1)^2 & 12(x + 1)^3 & 20(x + 1)^4 & 30(x + 1)^5\\ 0 & 0 & 2(x + 1)^2 & 6(x + 1)^3 & 12(x + 1)^4 & 20(x + 1)^5 & 30(x + 1)^6\\ 0 & 0 & 2(x + 1)^3 & 6(x + 1)^4 & 12(x + 1)^5 & 20(x + 1)^6 & 30(x + 1)^7\\ 0 & 0 & 2(x + 1)^4 & 6(x + 1)^5 & 12(x + 1)^6 & 20(x + 1)^7 & 30(x + 1)^8\\ 0 & 0 & 2(x + 1)^5 & 6(x + 1)^6 & 12(x + 1)^7 & 20(x + 1)^8 & 30(x + 1)^9\\ 0 & 0 & 2(x + 1)^6 & 6(x + 1)^7 & 12(x + 1)^8 & 20(x + 1)^9 & 30(x + 1)^{10}\end{bmatrix}\, dx \begin{bmatrix} d_0 \\ d_1 \\ d_2 \\ d_3 \\ d_4 \\ d_5 \\ d_6 \end{bmatrix}=-\frac{3}{2} \int_0^1 \begin{bmatrix} 1 \\ x+1 \\ (x+1)^2 \\ (x+1)^3 \\ (x+1)^4 \\ (x+1)^5 \\ (x+1)^6 \end{bmatrix} $$     (1.54)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


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

$$  \displaystyle \begin{bmatrix} 0 & 0 & 2 & 9 & 28 & 375/4 & 186\\ 0 & 0 & 3 & 14 & 45 & 155 & 315\\ 0 & 0 & 14/3 &  45/2 & 372/5 &  525/2 &   3810/7\\ 0 & 0 &  15/2  & 186/5 &    126 &  3175/7 &   3825/4\\ 0 & 0 &  62/5 &    63 & 1524/7 &  6375/8 &     5110/3\\ 0 & 0 &    21 & 762/7 &  765/2 & 12775/9 &  3069\\ 0 & 0 & 254/7 & 765/4 & 2044/3 &  5115/2 & 61410/11\end{bmatrix}\begin{bmatrix} d_0\\ d_1\\ d_2\\ d_3\\ d_4\\ d_5\\ d_6\end{bmatrix}=\begin{bmatrix} -3/2\\   -9/4\\    -7/2\\   -45/8\\  -93/10\\   -63/4\\ -381/14\end{bmatrix} $$     (1.55)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

3. Display in Matrix Form
We take the bottom 5 rows from Eq.3.55 and build a system of equations with Eq.3.49 and Eq.3.51.
 * {| style="width:100%" border="0"

$$  \displaystyle \begin{bmatrix} 1 & 2 & 4 & 8 & 16 & 32 & 64\\ 0 & 1 & 2 & 3 & 4 & 5 & 6\\ 0 & 0 & 14/3 &  45/2 & 372/5 &  525/2 &   3810/7\\ 0 & 0 &  15/2  & 186/5 &    126 &  3175/7 &   3825/4\\ 0 & 0 &  62/5 &    63 & 1524/7 &  6375/8 &     5110/3\\ 0 & 0 &    21 & 762/7 &  765/2 & 12775/9 &  3069\\ 0 & 0 & 254/7 & 765/4 & 2044/3 &  5115/2 & 61410/11\end{bmatrix}\begin{bmatrix} d_0\\ d_1\\ d_2\\ d_3\\ d_4\\ d_5\\ d_6\end{bmatrix}=\begin{bmatrix} 0\\   -4\\    -7/2\\   -45/8\\  -93/10\\   -63/4\\ -381/14\end{bmatrix} $$     (1.56)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

4. Solve for d
As in the $$n=4$$ case, we use a MATLAB code I wrote to determine the unknown $$ d_i's$$ to determine the final form of our approximation to the solution of the differential equation 3.1.
 * {| style="width:100%" border="0"

$$  \displaystyle \begin{bmatrix} d_0 \\ d_1 \\ d_2 \\ d_3 \\ d_4 \\ d_5 \\ d_6 \end{bmatrix}=\begin{bmatrix} 8 \\ -5/2 \\ -3/4 \\ 0 \\ 0 \\ 0 \\ 0 \end{bmatrix} $$     (1.57) Egm5526.s11.team-2.langpm 14:38, 14 February 2011 (UTC)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

5. Construct and Plot the Approximate and Exact Solution for u(x)
We can see from above in Eq.3.58 that our solution did not improve at all by an increase in n from 2 to 6. So we can see that indeed, the polynomial basis function converges much quicker to an exact solution than the cosine base functions we used in Problem 2.9. Egm5526.s11.team-2.langpm 14:39, 14 February 2011 (UTC)

Graphical Comparison Between the Exact and Numerical Solutions
Egm5526.s11.team-2.langpm 14:39, 14 February 2011 (UTC)

MATLAB Code for n=6 case
Egm5526.s11.team-2.langpm 22:36, 14 February 2011 (UTC)

=Problem 3.2: Determining the Reaction Forces Present in a System of Springs =

Given: A Spring System
For the spring system given in the figure.



Determine: The Global Stiffness Matrix and Force Matrix to Obtain the Reactions Forces for this System
<p style="text-align:left"> a) Number the elements and nodes. b) Assemble the global stiffness and force matrix. c) Partition the system and solve for the nodal displacements. d) Compute the reaction forces.

(a) Number the Elements and Nodes
The elements and nodes can be represented in the following fashion.

(b) Assemble the Global Stiffness and Force Matrix
Figure (3) shows a Free Body Diagram with the forces and reactions acting at each node.



Observing the FBD a system of equations can be defined in terms of the balance of forces for each element and the reactions and externals forces experienced by the system as the following column vectors; where $$ \displaystyle \mathbf{F^{(i)}} \quad i=1,\ldots,4\ $$ represents the appropriate element in the system, $$ \displaystyle \mathbf{f} $$ represents the external forces acting on the system and $$ \displaystyle  \mathbf{r} $$ represents the reactions of the system.

The column vectors are as follows

Substituing the above column vectors into (3.2.b.1) porvides the following system of equations.

The Forces experienced in a 2 node element can be defined with the following 2 equations in matrix form

where k is defined by the Area, Young's modulus and length of the element $$ \displaystyle k = AE/l $$

Employing the element stiffness found in (3.2.b.3) and aligning the element nodes to their respective global nodes as defined in Fig 3.

One begins by augmenting the force and displacement matrices by adding zeroes. The local element node number is equal to the global element node number by Fig 3. One performs this on all elements of the system. This provides each element of the system with respect to the global matrix of the system.

Substituting (3.2.b.4), (3.2.b.5), (3.2.b.6), (3.2.b.7) into (3.2.b.2) and performing matrix addtion provides the System of Equations governing the system, where the first matrix term on the LHS of (3.2.b.8) represents the global stiffness matrix and the RHS of (3.2.b.8) represents the global force matrix.

(c) Partition the System and Solve for the Nodal Displacements
Reviewing Fig. 1 the springs are attached to the wall. It can be assumed that element 1 and element 3 will have no displacement pass global node 1 & 4 and global node 4 & 2, respectively. Therefore $$ \displaystyle u_1 = u_2 = 0 $$ which modifies 3.2.b.8 to the following

Doing a sum of forces at Node 3 and using (3.2.b.5) & (3.2.b.7) provides a relation between the global displacements experienced between at 3 & 4 and since $$ \displaystyle  u_1 = 0 $$

This reduces the nodal displacements to the following

(d) Compute the Reaction Forces
Solving for the reaction forces using (3.2.b.9) & (3.2.b.11) leads to the following

=Problem 3.3 Finite element analysis of a four bar plane structure= ==Statement == Consider the truss structure given in Figure 1 below. Nodes A and B are fixed. A force equal to 10N acts in the positive x-direction at node C. Coordinates of joints are given in meters. Young’s modulus is $$E={{10}^{11}}$$pascals and the cross-sectional area for all bars are $$A=2*{{10}^{-2}}{{m}^{2}}$$.



Given: Force at node C, the Young's Modulus and bar cross sectional areas.
i) Force at node $$ \displaystyle c = {10}^{3}N$$. ii) Young's Modulus $$\displaystyle  E = {10^{11}}$$ Pa.  iii) $$\displaystyle  {{A}^{1}}={{A}^{3}}=A={{10}^{-2}}{{m}^{2}}$$ and  $$\quad \quad \quad \displaystyle  {{A}^{2}}=2A=2*{{10}^{-2}}{{m}^{2}}$$  iv) Point D is free to move in x direction only.

1. Number the Elements and Nodes
There are four elements and four nodes. We start numbering nodes from the fixed nodes and then arbitrarily assign numbers to other nodes. So A is assigned as none 1, B as node 2, D as node 3 and C as node 4 as shown in Figure 1 above. Element numbers are assigned as 1 to AD, 2 to BD, 3 to BC and 4 to DC.

b. Assemble the Global Stiffness Matrix and Force Matrix
Stiffness for a element in two dimensional coordinate system inclined to x axis at angle $$\phi $$ is given by


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

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

\displaystyle {K^e} = {k^e}\left[ {\begin{array}{ccccccccccccccc} &{\cos {\phi ^e}\sin {\phi ^e}}&{ - {{\cos }^2}{\phi ^e}}&{ - \cos {\phi ^e}\sin {\phi ^e}} \\ {\cos {\phi ^e}\sin {\phi ^e}}&&{ - \cos {\phi ^e}\sin {\phi ^e}}&{ - {{\sin }^2}{\phi ^e}} \\ { - {{\cos }^2}{\phi ^e}}&{ - \cos {\phi ^e}\sin {\phi ^e}}&&{\cos {\phi ^e}\sin {\phi ^e}} \\ { - \cos {\phi ^e}\sin {\phi ^e}}&{ - {{\sin }^2}{\phi ^e}}&{\cos {\phi ^e}\sin {\phi ^e}}& \end{array}} \right] $$     (3.1)
 * <p style="text-align:right">
 * }

Where $${k^e} = \frac$$

For element 1 $$ {\phi ^1} = {90^o} $$, Global node numbers 1 & 3
 * {| style="width:100%" border="0"

$$  \displaystyle {K}^{1} = AE \begin{matrix} \begin{matrix} {[1]}\quad & \quad {[3]} \end{matrix} \\ \begin{bmatrix} 0 & 0 & 0 &0  \\ 0 &  1 & 0 &-1 \\ 0 &  0 & 0 &0 \\ 0 & -1 & 0 &1 \end{bmatrix}  & \begin{align} {[1]} \\\\ {[3]} \end{align} \end{matrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

For element 2 $$ {\phi ^2} = {135^o} $$,Global node numbers 2 & 3


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

$$  \displaystyle
 * style="width:95%" |
 * style="width:95%" |

{K}^{2} = AE \begin{matrix} \begin{matrix} {[2]}\quad & \quad {[3]} \end{matrix} \\ \begin{bmatrix} \frac{1}{2\sqrt{2}} &-\frac{1}{2\sqrt{2}} &-\frac{1}{2\sqrt{2}}  &\frac{1}{2\sqrt{2}} \\ -\frac{1}{2\sqrt{2}} &\frac{1}{2\sqrt{2}} &\frac{1}{2\sqrt{2}}  & -\frac{1}{2\sqrt{2}}\\ -\frac{1}{2\sqrt{2}}&\frac{1}{2\sqrt{2}} &\frac{1}{2\sqrt{2}}  &-\frac{1}{2\sqrt{2}} \\ \frac{1}{2\sqrt{2}}&-\frac{1}{2\sqrt{2}} & -\frac{1}{2\sqrt{2}} & \frac{1}{2\sqrt{2}} \end{bmatrix} & \begin{align} {[2]} \\\\ {[3]} \end{align} \end{matrix} $$
 * }
 * }

For element 3 $$ {\phi ^3} = {90^o} $$,Global node numbers 2 & 4
 * {| style="width:100%" border="0"

$$  \displaystyle
 * style="width:95%" |
 * style="width:95%" |

{K}^{3} = AE \begin{matrix} \begin{matrix} {[2]}\quad & \quad {[4]} \end{matrix} \\ \begin{bmatrix} 0 & 0 & 0 &0  \\ 0 &  1 & 0 &-1 \\ 0 &  0 & 0 &0 \\ 0 & -1 & 0 &1 \end{bmatrix}  & \begin{align} {[2]} \\\\ {[4]} \end{align} \end{matrix} $$
 * }
 * }

For element 4 $$ {\phi ^4} = {0^o} $$,Global node numbers 3 & 4
 * {| style="width:100%" border="0"

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

{K}^{4} = AE \begin{matrix} \begin{matrix} {[3]}\quad & \quad {[4]} \end{matrix} \\ \begin{bmatrix} 1 & 0 & -1 &0  \\ 0 &  0 & 0 &0 \\ -1 &  0 & 1 &0 \\ 0 & 0 & 0 &0 \end{bmatrix}  & \begin{align} {[3]} \\\\ {[4]} \end{align} \end{matrix} $$
 * }
 * }

Global matrix can be found by adding corresponding elements of each matrix.
 * {| style="width:100%" border="0"

$$  \displaystyle K = AE\left[ {\begin{array}{ccccccccccccccc} 0&0&0&0&0&0&0&0 \\  0&1&0&0&0&{ - 1}&0&0 \\   0&0&{\frac{1}}&{ - \frac{1}}&{ - \frac{1}}&{\frac{1}}&0&0 \\ 0&0&{ - \frac{1}}&{1 + \frac{1}}&{\frac{1}}&{ - \frac{1}}&0&{ - 1} \\ 0&0&{ - \frac{1}}&{\frac{1}}&{1 + \frac{1}}&{ - \frac{1}}&{ - 1}&0 \\ 0&{ - 1}&{\frac{1}}&{ - \frac{1}}&{ - \frac{1}}&{1 + \frac{1}}&0&0 \\ 0&0&0&0&{ - 1}&0&1&0 \\  0&0&0&{ - 1}&0&0&0&1 \end{array}} \right] $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Matrix $$d$$ and $$ f+r$$ will be as follows


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

$$  \displaystyle d = \left[ {\begin{array}{ccccccccccccccc} 0 \\  0 \\   0 \\   0 \\    \\    \\    \\ \end{array}} \right]f + r = \left[ {\begin{array}{ccccccccccccccc} \\   \\    \\    \\   0 \\   0 \\   {10} \\   0 \end{array}} \right] $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Now writing global system of equations
 * {| style="width:100%" border="0"

$$  \displaystyle Kd = f + r $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


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

$$  \displaystyle AE\left[ {\begin{array}{ccccccccccccccc} 0&0&0&0&\vline & 0&0&0&0 \\ 0&1&0&0&\vline & 0&{ - 1}&0&0 \\ 0&0&{\frac{1}}&{ - \frac{1}}&\vline & { - \frac{1}}&{\frac{1}}&0&0 \\ 0&0&{ - \frac{1}}&{1 + \frac{1}}&\vline & {\frac{1}}&{ - \frac{1}}&0&{ - 1} \\ \hline 0&0&{ - \frac{1}}&{\frac{1}}&\vline & {1 + \frac{1}}&{ - \frac{1}}&{ - 1}&0 \\ 0&{ - 1}&{\frac{1}}&{ - \frac{1}}&\vline & { - \frac{1}}&{1 + \frac{1}}&0&0 \\ 0&0&0&0&\vline & { - 1}&0&1&0 \\ 0&0&0&{ - 1}&\vline & 0&0&0&1 \end{array}} \right]\left[ {\begin{array}{ccccccccccccccc} 0 \\  0 \\   0 \\   0 \\ \hline \\   \\    \\ \end{array}} \right] = \left[ {\begin{array}{ccccccccccccccc} \\   \\    \\    \\ \hline 0 \\  0 \\   {10} \\   0 \end{array}} \right] $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

3. Partition the System and Solve for the Nodal Displacements
The partitions are done according to the fixed number of nodes. There are two fixed node so matrices are partitioned after fourth row and fourth column.
 * {| style="width:100%" border="0"

$$ \displaystyle \begin{align} {K_E} &= AE\left[ {\begin{array}{ccccccccccccccc} 0&0&0&0 \\  0&1&0&0 \\   0&0&{\frac{1}}&{ - \frac{1}} \\ 0&0&{ - \frac{1}}&{1 + \frac{1}} \end{array}} \right] &&{K_{EF}} = AE\left[ {\begin{array}{ccccccccccccccc} 0&0&0&0 \\  0&{ - 1}&0&0 \\   { - \frac{1}}&{\frac{1}}&0&0 \\ {\frac{1}}&{ - \frac{1}}&0&{ - 1} \end{array}} \right] &&&{{\tilde d}_E} = \left[ {\begin{array}{ccccccccccccccc} 0 \\  0 \\   0 \\   0 \end{array}} \right] &&&& {r_E} = \left[ {\begin{array}{ccccccccccccccc} \\   \\    \\ \end{array}} \right] \\
 * style="width:95%" |
 * style="width:95%" |

& &&{K_F} = AE\left[ {\begin{array}{ccccccccccccccc} {1 + \frac{1}}&{ - \frac{1}}&{ - 1}&0 \\ { - \frac{1}}&{1 + \frac{1}}&0&0 \\ { - 1}&0&1&0 \\  0&0&0&1 \end{array}} \right] &&&{d_F} = \left[ {\begin{array}{ccccccccccccccc} \\   \\    \\ \end{array}} \right]

&&&& {f_F} = \left[ {\begin{array}{ccccccccccccccc} 0 \\  0 \\   {10} \\   0 \end{array}} \right] \end{align} $$
 * }
 * }


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

$$ \begin{align} \displaystyle {K_{EF}}^T{\cancelto{0}{{\tilde d}_E}} + {K_F}{d_F} &= {f_F} \\ {K_F}{d_F}                                         &= {f_F} \\ {d_F} &= K_F^{ - 1}{f_F} \end{align} $$     (3.2)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


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

$$  \displaystyle \begin{align} {r_E} &= {K_E}{\cancelto{0}{{\tilde d}_E}} + {K_{EF}}{d_F} \\ {r_E} &= {K_{EF}}{d_F} \end{align} $$     (3.4)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


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

$$  \displaystyle {r_E} = \left[ {\begin{array}{ccccccccccccccc} 0 \\  { - 10} \\   { - 10} \\   {10} \end{array}} \right] $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

4. Compute the Stresses and Reactions
Stresses in the elements.


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

$$  \displaystyle {\sigma ^e} = \frac\left[ {\begin{array}{ccccccccccccccc} { - \cos {\varphi ^e}}&{ - \sin {\varphi ^e}}&{\cos {\varphi ^e}}&{\sin {\varphi ^e}} \end{array}} \right]{d^e} $$     (3.7)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

For element 1 $$\varphi = {90^o}$$
 * {| style="width:100%" border="0"

$$  \displaystyle {d^1} = \left[ {\begin{array}{ccccccccccccccc} \\   \\    \\ \end{array}} \right] = \left[ {\begin{array}{ccccccccccccccc} 0 \\  0 \\   {0.1914} \\   {0.05} \end{array}} \right] \times {10^{ - 7}} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


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

$$  \displaystyle {\sigma ^1} = \frac{1}\left[ {\begin{array}{ccccccccccccccc} 0&{ - 1}&0&1 \end{array}} \right]\left[ {\begin{array}{ccccccccccccccc} 0 \\  0 \\   {0.1914} \\   {0.05} \end{array}} \right] \times {10^{ - 7}} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

For element 2 $$\varphi = {135^o}$$


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

$$  \displaystyle {d^2} = \left[ {\begin{array}{ccccccccccccccc} \\   \\    \\ \end{array}} \right] = \left[ {\begin{array}{ccccccccccccccc} 0 \\  0 \\   {0.1914} \\   {0.05} \end{array}} \right] \times {10^{ - 7}} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


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

$$  \displaystyle {\sigma ^2} = \frac{1}\left[ {\begin{array}{ccccccccccccccc} {\frac{1}}&{ - \frac{1}}&{ - \frac{1}}&{\frac{1}} \end{array}} \right]\left[ {\begin{array}{ccccccccccccccc} 0 \\  0 \\   {0.1914} \\   {0.05} \end{array}} \right] \times {10^{ - 7}} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

For element 3 $$\varphi = {90^o}$$


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

$$  \displaystyle {d^3} = \left[ {\begin{array}{ccccccccccccccc} \\   \\    \\ \end{array}} \right] = \left[ {\begin{array}{ccccccccccccccc} 0 \\  0 \\   {0.2414} \\   0 \end{array}} \right] \times {10^{ - 7}} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


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

$$  \displaystyle {\sigma ^3} = \frac{1}\left[ {\begin{array}{ccccccccccccccc} 0&{ - 1}&0&1 \end{array}} \right]\left[ {\begin{array}{ccccccccccccccc} 0 \\  0 \\   {0.2414} \\   0 \end{array}} \right] \times {10^{ - 7}} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

For element 4 $$\varphi = {0^o}$$


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

$$  \displaystyle {d^4} = \left[ {\begin{array}{ccccccccccccccc} \\   \\    \\ \end{array}} \right] = \left[ {\begin{array}{ccccccccccccccc} {0.1914} \\  {0.05} \\   {0.2414} \\   0 \end{array}} \right] \times {10^{ - 7}} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


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

$$  \displaystyle {\sigma ^4} = \frac{1}\left[ {\begin{array}{ccccccccccccccc} { - 1}&0&1&{0} \end{array}} \right]\left[ {\begin{array}{ccccccccccccccc} {0.1914} \\  {0.05} \\   {0.2414} \\   0 \end{array}} \right] \times {10^{ - 7}} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

=Problem 3.4 Verification That K is Not Symmetric in the WRF=

Given: Definition of the Stiffness Matrix
Let $$ \displaystyle \bar{K_{i,j}} $$ be defined as the stiffness matrix in the WRF
 * {| style="width:100%" border="0"

$$ \displaystyle \bar{K_{i,j}} := \int_{\Omega}{b_i(x)\left[ \frac{\partial}{\partial x}\left(a_2(x) \frac{\partial}{\partial x}b_j(x)\right)\right]dx} $$     (4.1)
 * style="width:98%" |
 * style="width:98%" |
 * <p style="text-align:right">
 * }

Similarly, let $$ \displaystyle \bar{K_{j,i}} $$ be defined as the transpose of $$ \displaystyle \bar{K_{i,j}} $$
 * {| style="width:100%" border="0"

$$ \displaystyle \bar{K_{j,i}} := \int_{\Omega}{b_j(x)\left[ \frac{\partial}{\partial x}\left(a_2(x) \frac{\partial}{\partial x}b_i(x)\right)\right]dx} $$     (4.2)
 * style="width:98%" |
 * style="width:98%" |
 * <p style="text-align:right">
 * }

Let $$ \displaystyle {\color{red}\alpha} $$ and $$ \displaystyle {\color{blue}\beta} $$ be defined as the integrand of (4.1) and (4.2), respectively.
 * {| style="width:100%" border="0"

$$ \displaystyle \bar{K_{i,j}} := \int_{\Omega}{\color{red}\underbrace{ {b_i(x)\left[ \frac{\partial}{\partial x}\left(a_2(x) \frac{\partial}{\partial x}b_j(x)\right)\right]}}_{\alpha :=}}dx $$     (4.3)
 * style="width:98%" |
 * style="width:98%" |
 * <p style="text-align:right">
 * }


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

$$ \displaystyle \bar{K_{j,i}} := \int_{\Omega}{\color{blue}\underbrace{ {b_j(x)\left[ \frac{\partial}{\partial x}\left(a_2(x) \frac{\partial}{\partial x}b_i(x)\right)\right]}}_{\beta :=}}dx $$     (4.4)
 * style="width:98%" |
 * style="width:98%" |
 * <p style="text-align:right">
 * }

Show: In the WRF the Stiffness Matrix Need Not Be Symmetric
That following holds for
 * {| style="width:100%" border="0"

$$ \displaystyle \alpha \neq \beta \quad \forall \quad i\neq j $$
 * style="width:98%" |
 * style="width:98%" |
 * <p style="text-align:right">
 * }

Where $$ \displaystyle \alpha $$ and $$ \displaystyle \beta $$ defined in (4.3) and (4.4) as


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

$$ \displaystyle \alpha := b_i(x)\left[(a_{2}'b_{j}'(x)+a_{2}(x)b_{j}''\right] $$     (4.5)
 * style="width:98%" |
 * style="width:98%" |
 * <p style="text-align:right">
 * }


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

$$ \displaystyle \beta := b_j(x)\left[(a_{2}'b_{i}'(x)+a_{2}(x)b_{i}''\right] $$      (4.6)
 * style="width:98%" |
 * style="width:98%" |
 * <p style="text-align:right">
 * }

For simplicity let use take $$ \displaystyle b_i(x) $$ and $$ \displaystyle b_j(x) $$ to be
 * {| style="width:100%" border="0"

$$ \displaystyle b_i(x) := cos(ix) $$     (4.7)
 * style="width:98%" |
 * style="width:98%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$ \displaystyle b_j(x) := cos(jx) $$     (4.8)
 * style="width:98%" |
 * style="width:98%" |
 * <p style="text-align:right">
 * }

Solution: Proof by Contradiction
Consider the first and second derivatives of $$ \displaystyle b_i(x) $$ and $$ \displaystyle b_j(x) $$,
 * {| style="width:100%" border="0"

$$ \displaystyle \frac{d(b_i(x))}{dx} = -isin(ix) = b_i'(x) $$     (4.9)
 * style="width:98%" |
 * style="width:98%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$ \displaystyle \frac{d(b_i(x))}{dx} = -i^2cos(ix) = b_i''(x) $$     (4.10)
 * style="width:98%" |
 * style="width:98%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$ \displaystyle \frac{d(b_j(x))}{dx} = -jsin(jx) = b_j'(x) $$     (4.11)
 * style="width:98%" |
 * style="width:98%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$ \displaystyle \frac{d(b_j(x))}{dx} = -j^2cos(jx) = b_j''(x) $$     (4.12) Let us now make the appropriate substitutions of (4.7), (4.11), and (4.12) into $$ \displaystyle \alpha $$ shown in (4.5) to get
 * style="width:98%" |
 * style="width:98%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$ \displaystyle \begin{align} \alpha &= b_i(x)\left[(a_{2}'b_{j}'(x)+a_{2}(x)b_{j}''\right] \\      &= cos(ix)\left[a'_2\left(-jsin(jx)\right)+a_2\left( -j^2cos(jx)\right) \right]\\       &= -ja'_2cos(ix)sin(jx) - j^2a_2cos(ix)cos(jx) \end{align}$$      (4.13)
 * style="width:98%" |
 * style="width:98%" |
 * <p style="text-align:right">
 * }

Similarly for $$ \displaystyle \beta $$ subtituting (4.8), (4.9), and (4.10) into (4.6) we get
 * {| style="width:100%" border="0"

$$ \displaystyle \begin{align} \beta &= b_j(x)\left[(a_{2}'b_{i}'(x)+a_{2}(x)b_{i}''\right] \\     &= cos(jx)\left[a'_2\left(-isin(ix)\right)+a_2\left( -i^2cos(ix)\right) \right]\\      &= -ia'_2cos(jx)sin(ix) - i^2a_2cos(jx)cos(ix) \end{align}$$      (4.14)
 * style="width:98%" |
 * style="width:98%" |
 * <p style="text-align:right">
 * }

For the sake of presenting the most mathematically rigorous proof, we will proceed using proof by contradiction. Essentially what we will do is summarized in the following 3 steps: '''STEP 1. '''Assume the logical negation of the conclusion, $$ \displaystyle i.e. \quad \alpha = \beta $$ '''STEP 2. '''Do some algebra to arrive at a mathematically equivalent expression for $$ \displaystyle \alpha = \beta $$ '''STEP 3. Arrive at a conclusion based on this equivalent expression for which it CONTRADICTS''' the original premise namely, $$ \displaystyle i \neq j$$

STEP 1: Assume the Logical Negation of the Conclusion
Since we wish to show that $$ \displaystyle \alpha \neq \beta $$ we will assume the logical negation of this which is $$ \displaystyle \alpha = \beta $$. Doing so we arrive at


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

$$ \displaystyle \begin{align} \alpha &= \beta \\ -ja'_2cos(ix)sin(jx) - j^2a_2cos(ix)cos(jx) &= -ia'_2cos(jx)sin(ix) - i^2a_2cos(jx)cos(ix) \end{align}$$ (4.15)
 * style="width:98%" |
 * style="width:98%" |
 * <p style="text-align:right">
 * }

STEP 2: Do Some Algebra
To arrive at a mathematically equivalent expression for $$ \displaystyle \alpha = \beta $$ we will rewrite (4.15) into a "better suited" form


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

$$ \displaystyle \begin{align} & -ja'_2cos(ix)sin(jx) - j^2a_2cos(ix)cos(jx) && = -ia'_2cos(jx)sin(ix) - i^2a_2cos(jx)cos(ix) \\ & \implies \quad\quad\quad\quad {\color{red}\left( \frac{1}{cos(ix)}\right)}{\color{blue}\left( \frac{1}{cos(jx)}\right)} LHS && ={\color{red}\left( \frac{1}{cos(ix)}\right)}{\color{blue}\left( \frac{1}{cos(jx)}\right)} \left[ja'_2\cancelsin(jx) + j^2a_2\cancel\cancel\right]\\ & \implies \quad\quad\quad\quad {\color{red}\left( \frac{1}{cos(ix)}\right)}{\color{blue}\left( \frac{1}{cos(jx)}\right)} RHS && = {\color{red}\left( \frac{1}{cos(ix)}\right)}{\color{blue}\left( \frac{1}{cos(jx)}\right)} \left[ia'_2\cancelsin(ix)+ i^2a_2\cancel\cancel\right]\\ & \implies \quad\quad \quad\quad \quad\quad ja'_2\left(\frac{sin(jx)}{cos(jx)}\right) + j^2a_2 && = ia'_2\left(\frac{sin(ix)}{cos(ix)}\right) + i^2a_2 \\ & \implies \quad\quad \quad\quad\quad\quad \quad\quad ja'_2 tan(jx) + j^2a_2 && = ia'_2tan(ix) + i^2a_2 \\ & \implies a'_2 [{\color{cyan}\underbrace{itan(ix) -jtan(jx)}_{f(x)}}] - a_2[{\color{magenta}\underbrace{i^2 - j^2}_{g(x)}}] && = 0 \end{align}$$ (4.16)
 * style="width:98%" |
 * style="width:98%" |
 * <p style="text-align:right">
 * }

STEP 3: Arrive at a Contradiction
The only way the final equation, in the series of equations shown in (4.16), holds is if $$ \displaystyle {\color{cyan}f(x)} $$ and/or $$ \displaystyle {\color{magenta}g(x)} $$ is equal to zero.
 * {| style="width:100%" border="0"

$$ \displaystyle \begin{align} f(x) &=0 \quad \implies \quad itan(ix) && = jtan(jx) \\ g(x) &=0 \quad \implies \quad \quad \quad i^2 && = j^2 \end{align}$$ (4.17)
 * style="width:98%" |
 * style="width:98%" |
 * <p style="text-align:right">
 * }

And the only way that (4.17) can hold for integer values of $$ i $$ and $$ j $$ is if $$ \displaystyle i = j $$. This is a contradiction to the premise stating that $$ \displaystyle i \neq j $$, therefore we have reached a contradiction which allow us to conclude that,

=Problem 3.5 Determining the Equivalent Stiffness of a Spring=

Problem Statement: Restatement from Atkinson
Determine the equivalent stiffness of spring oriented with the $$ x-direction $$ horizontal to the bar shown below in the figure. Assume that the bar has a thickness $$ t $$ and where all other dimensions are defined below in the figure.



Find: The Spring Stiffness Equivalence
That the equivalent spring stiffness $$ \displaystyle k_{eq} $$ is given by,
 * {| style="width:100%" border="0"

$$ \displaystyle k_{eq} = \frac{5Etab}{l(a+b)} $$     (5.1)
 * style="width:98%" |
 * style="width:98%" |
 * <p style="text-align:right">
 * }

Where $$ \displaystyle E $$ is defined as Young's modulus.

Solution: Reducing the Spring Elements in Parallel and in Series to a Single Equivalent Spring
Let $$\displaystyle k^{(1)},k^{(2)},k^{(3)} $$ and $$\displaystyle k^{(4)} $$ be the four spring constants for the system shown below.



It can be observed that $$ \displaystyle k^{(1)} = k^{(3)} $$ and $$ \displaystyle k^{(2)} = k^{(4)} $$ for this system. Furthermore we know that the elemental stiffness of this system can be described by the following equation.
 * {| style="width:100%" border="0"

$$ \displaystyle k^e = \frac{A^e E^e}{l^e}$$ (5.2)
 * style="width:98%" |
 * style="width:98%" |
 * <p style="text-align:right">
 * }

This combined with the information we have shown if Figure 2 allows us to write the following relation for $$\displaystyle k^{(1)}$$ and $$\displaystyle k^{(3)} $$,
 * {| style="width:100%" border="0"

$$ \displaystyle \begin{align} l^{(1)} &= \frac{l}{10} \quad             && = l^{(3)} \\ k^{(1)} &= \frac{A^{(1)} E^{(1)}}{l^{(1)}} && = k^{(3)} \\ \implies k^{(1)} &= \frac{10atE}{l}       && = k^{(3)} \end{align}$$ (5.3)
 * style="width:98%" |
 * style="width:98%" |
 * <p style="text-align:right">
 * }

Similarly, for $$\displaystyle k^{(2)}$$ and $$\displaystyle k^{(4)} $$ we have
 * {| style="width:100%" border="0"

$$ \displaystyle \begin{align} l^{(2)} &= \frac{4l}{5} \quad              && = l^{(4)} \\ k^{(2)} &= \frac{A^{(2)} E^{(2)}}{l^{(2)}} && = k^{(4)} \\ \implies k^{(2)} &= \frac{5btE}{2l}        && = k^{(4)} \end{align}$$ (5.4)
 * style="width:98%" |
 * style="width:98%" |
 * <p style="text-align:right">
 * }

Since $$\displaystyle k^{(2)}$$ and $$\displaystyle k^{(4)} $$ are in parallel we can define $$\displaystyle k^{para}_{eq} $$ as the equivalent stiffness for elements 2 and 4
 * {| style="width:100%" border="0"

$$ \displaystyle k^{para}_{eq} = k^{(2)} + k^{(4)} = 2k^{(2)} $$     (5.5)
 * style="width:98%" |
 * style="width:98%" |
 * <p style="text-align:right">
 * }

Schematically, we now have the three springs $$\displaystyle k^{(1)}, k^{para}_{eq} $$ and $$ \displaystyle k^{(1)} $$ in series. Springs in series are related to the net equivalent spring stiffness by the following inverse relationship,
 * {| style="width:100%" border="0"

$$ \displaystyle\begin{align} \frac{1}{k^{net}_{eq}} &= \frac{1}{k^{(1)}} + \frac{1}{\cancelto{k^{para}_{eq}}} + \frac{1}{\cancelto{k^{(3)}}}\\ &= \frac{1}{k^{(1)}} + \frac{1}{2k^{(2)}} + \frac{1}{k^{(1)}} \\ &= \frac{2}{k^{(1)}} + \frac{1}{2k^{(2)}} \end{align}$$ (5.6)
 * style="width:98%" |
 * style="width:98%" |
 * <p style="text-align:right">
 * }

Next we will take the reciprocal of (5.6) to get
 * {| style="width:100%" border="0"

$$ \displaystyle\begin{align} k^{net}_{eq} &= \left(\frac{1}{\frac{2}{k^{(1)}} + \frac{1}{2k^{(2)}}}\right) {\color{red}\left(\frac{k^{(1)}k^{(2)}}{k^{(1)}k^{(2)}} \right)}\\ &= \frac{k^{(1)}k^{(2)}}{\frac{k^{(1)}}{2}+2k^{(2)}} \\ &= \frac{ \left(\frac{10atE}{l}\right) \left(\frac{5btE}{2l}\right)}{\frac{1}{2}\left(\frac{10atE}{l}\right) + 2\left(\frac{5btE}{2l}\right)} \\ &= \frac{5abET}{l(a+b)} \end{align}$$ (5.7)
 * style="width:98%" |
 * style="width:98%" |
 * <p style="text-align:right">
 * }

The final solution is
 * {| style="width:100%" border="0" cellpadding="5" cellspacing="0"

(5.8)
 * style="width:10%" |
 * style="width:80%" |
 * style="width:10%" | <p style="text-align:right">
 * style="width:10%" | <p style="text-align:right">
 * }

=Problem 3.6 Finite Element Analysis of Three Bar Hanging Structure= ==Statement == Given the three-bar structure subjected to the prescribed load at point C equal to $$ 10^3 $$ N as shown in Figure 2.19.The Young’s modulus is         $$ E = {10^{11}}$$ Pa, the  cross-sectional area of the bar  BC is          $$2*{10^{ - 2}}{m^2}$$ and that  of BD  and  BF is   $${10^{ - 2}}{m^2}$$. Note that point D is free to move in the x-direction. Coordinates of joints are given in meters.



Given: Force at node C, the Young's Modulus and bar cross sectional areas.
i) Force at node $$ \displaystyle C = {10}^{3}N$$. ii) Young's Modulus $$\displaystyle  E = {10^{11}}$$ Pa.  iii) $$\displaystyle  {{A}^{1}}={{A}^{3}}=A={{10}^{-2}}{{m}^{2}}$$ and  $$\quad \quad \quad \displaystyle  {{A}^{2}}=2A=2*{{10}^{-2}}{{m}^{2}}$$  iv) Point D is free to move in x direction only.

1. Construct the Global Stiffness Matrix and Load Matrix Solution
There are three elements and four nodes. Stiffness for a element in two dimensional coordinate system inclined to x axis at angle $$\phi $$ is given by


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

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

\displaystyle {K^e} = {k^e}\left[ {\begin{array}{ccccccccccccccc} &{\cos {\phi ^e}\sin {\phi ^e}}&{ - {{\cos }^2}{\phi ^e}}&{ - \cos {\phi ^e}\sin {\phi ^e}} \\ {\cos {\phi ^e}\sin {\phi ^e}}&&{ - \cos {\phi ^e}\sin {\phi ^e}}&{ - {{\sin }^2}{\phi ^e}} \\ { - {{\cos }^2}{\phi ^e}}&{ - \cos {\phi ^e}\sin {\phi ^e}}&&{\cos {\phi ^e}\sin {\phi ^e}} \\ { - \cos {\phi ^e}\sin {\phi ^e}}&{ - {{\sin }^2}{\phi ^e}}&{\cos {\phi ^e}\sin {\phi ^e}}& \end{array}} \right] $$     (6.1)
 * <p style="text-align:right">
 * }

For element 1 $$ {\phi ^1} = {{-45}^o} $$, Global node numbers 1 & 4
 * {| style="width:100%" border="0"

$$  \displaystyle {K}^{1} = \frac \begin{matrix} \begin{matrix} {[1]}\quad & \quad {[4]} \end{matrix} \\ \begin{bmatrix} {1/2}&{-1/2}&{-1/2}&{1/2} \\  {-1/2}&{1/2}&{1/2}&{-1/2} \\   {-1/2}&{1/2}&{1/2}&{-1/2} \\   {1/2}&{-1/2}&{-1/2}&{1/2} \end{bmatrix}  & \begin{align} {[1]} \\\\ {[4]} \end{align} \end{matrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

For element 2 $$ {\phi ^2} = {{-90}^o} $$,Global node numbers 2 & 4


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

$$ \displaystyle {K}^{2} = 2AE \begin{matrix} \begin{matrix} {[2]}\quad & \quad {[4]} \end{matrix} \\ \begin{bmatrix} 0&0&0&0 \\  0&1&0&{ - 1} \\   0&0&0&0 \\   0&{ - 1}&0&1 \end{bmatrix}  & \begin{align} {[2]} \\\\ {[4]} \end{align} \end{matrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


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

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

{K}^{2} = AE \begin{matrix} \begin{matrix} {[2]}\quad & \quad {[4]} \end{matrix} \\ \begin{bmatrix} 0&0&0&0 \\  0&2&0&{ - 2} \\   0&0&0&0 \\   0&{ - 2}&0&2 \end{bmatrix}  & \begin{align} {[2]} \\\\ {[4]} \end{align} \end{matrix} $$
 * }
 * }

For element 3 $$ {\phi ^4} = {{-135}^o} $$,Global node numbers 3 & 4
 * {| style="width:100%" border="0"

$$ {K}^{3} = \frac \begin{matrix} \begin{matrix} {[3]}\quad & \quad {[4]} \end{matrix} \\ \begin{bmatrix} {1/2}&{1/2}&{-1/2}&{-1/2} \\  {1/2}&{1/2}&{-1/2}&{-1/2} \\   {-1/2}&{-1/2}&{1/2}&{1/2} \\   {-1/2}&{-1/2}&{1/2}&{1/2} \end{bmatrix}  & \begin{align} {[3]} \\\\ {[4]} \end{align} \end{matrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Global matrix can be found by adding corresponding elements of each matrix.


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

$$  \displaystyle K = \frac\left[ {\begin{array}{ccccccccccccccc} {\frac{1}{2}}&{ - \frac{1}{2}}&0&0&0&0&{ - \frac{1}{2}}&{\frac{1}{2}} \\ { - \frac{1}{2}}&{\frac{1}{2}}&0&0&0&0&{\frac{1}{2}}&{ - \frac{1}{2}} \\ 0&0&0&0&0&0&0&0 \\  0&0&0&{2\sqrt 2} &0&0&0&{ - 2\sqrt 2 } \\ 0&0&0&0&{\frac{1}{2}}&{\frac{1}{2}}&{ - \frac{1}{2}}&{ - \frac{1}{2}} \\ 0&0&0&0&{\frac{1}{2}}&{\frac{1}{2}}&{ - \frac{1}{2}}&{ - \frac{1}{2}} \\ { - \frac{1}{2}}&{\frac{1}{2}}&0&0&{ - \frac{1}{2}}&{ - \frac{1}{2}}&1&0 \\ {\frac{1}{2}}&{ - \frac{1}{2}}&0&{ - 2\sqrt 2 }&{ - \frac{1}{2}}&{ - \frac{1}{2}}&0&{1+2\sqrt 2} \end{array}} \right] $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


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

$$  \displaystyle d = \left[ {\begin{array}{ccccccccccccccc} 0 \\  0 \\   0 \\   0 \\    \\   0 \\    \\ \end{array}} \right] f + r = \left[ {\begin{array}{ccccccccccccccc} \\   \\    \\    \\   0 \\    \\    \\   0 \end{array}} \right] $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Now writing global system of equations
 * {| style="width:100%" border="0"

$$  \displaystyle Kd = f + r $$ Swapping the row 5&6 of $$K$$,$$d$$ and $$f+r$$ matrices, and column 5&6 of$$K$$ matrix.
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle \frac\left[ {\begin{array}{ccccccccccccccc} {\frac{1}{2}}&{ - \frac{1}{2}}&0&0&0&\vline & 0&{ - \frac{1}{2}}&{\frac{1}{2}} \\ { - \frac{1}{2}}&{\frac{1}{2}}&0&0&0&\vline & 0&{\frac{1}{2}}&{ - \frac{1}{2}} \\ 0&0&0&0&0&\vline & 0&0&0 \\ 0&0&0&{2\sqrt 2 }&0&\vline & 0&0&{ - 2\sqrt 2 } \\ 0&0&0&0&{\frac{1}{2}}&\vline & {\frac{1}{2}}&{ - \frac{1}{2}}&{ - \frac{1}{2}} \\ \hline 0&0&0&0&{\frac{1}{2}}&\vline & {\frac{1}{2}}&{ - \frac{1}{2}}&{ - \frac{1}{2}} \\ { - \frac{1}{2}}&{\frac{1}{2}}&0&0&{ - \frac{1}{2}}&\vline & { - \frac{1}{2}}&1&0 \\ {\frac{1}{2}}&{ - \frac{1}{2}}&0&{ - 2\sqrt 2 }&{ - \frac{1}{2}}&\vline & { - \frac{1}{2}}&0&1+2\sqrt 2 \end{array}} \right]\left[ {\begin{array}{ccccccccccccccc} 0 \\  0 \\   0 \\   0 \\   0 \\ \hline \\   \\ \end{array}} \right] = \left[ {\begin{array}{ccccccccccccccc} \\   \\    \\    \\    \\ \hline 0 \\   \\   0 \end{array}} \right] $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

2. Partition the Matrices and Solve for the Unknown Displacements
The partitions are done according to the fixed number of nodes. There are two fixed node so matrices are partitioned after fourth row and fourth column.


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

$$  \displaystyle {K_E} = \frac\left[ {\begin{array}{ccccccccccccccc} {\frac{1}{2}}&{ - \frac{1}{2}}&0&0&0 \\ { - \frac{1}{2}}&{\frac{1}{2}}&0&0&0 \\ 0&0&0&0&0 \\  0&0&0&2\sqrt 2 &0 \\ 0&0&0&0&{\frac{1}{2}} \end{array}} \right] {K_{EF}} = \frac\left[ {\begin{array}{ccccccccccccccc} 0&{ - \frac{1}{2}}&{\frac{1}{2}} \\ 0&{\frac{1}{2}}&{ - \frac{1}{2}} \\ 0&0&0 \\  0&0&{ - 2\sqrt 2 } \\ {\frac{1}{2}}&{ - \frac{1}{2}}&{ - \frac{1}{2}} \end{array}} \right] $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


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

$$  \displaystyle {K_F} = \frac\left[ {\begin{array}{ccccccccccccccc} {\frac{1}{2}}&{ - \frac{1}{2}}&{ - \frac{1}{2}} \\ { - \frac{1}{2}}&1&0 \\ { - \frac{1}{2}}&0&1+2\sqrt 2 \end{array}} \right] {d_F} = \left[ {\begin{array}{ccccccccccccccc} \\   \\ \end{array}} \right] {f_F} = \left[ {\begin{array}{ccccccccccccccc} 0 \\   \\   0 \end{array}} \right] $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


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

$$  \displaystyle {{\tilde d}_E} = \left[ {\begin{array}{ccccccccccccccc} 0 \\  0 \\   0 \\   0 \\   0 \end{array}} \right] {r_E} = \left[ {\begin{array}{ccccccccccccccc} \\   \\    \\    \\ \end{array}} \right] $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


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

$$  \displaystyle {K_{EF}}^T{\cancelto{0}{{\tilde d}_E}} + {K_F}{d_F} = {f_F}
 * style="width:95%" |
 * style="width:95%" |

$$     (6.2)
 * <p style="text-align:right">
 * }


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

$$  \displaystyle {K_F}{d_F} = {f_F} $$     (6.3)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


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

$$  \displaystyle {d_F} = K_F^{ - 1}{f_F} $$     (6.4)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


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

$$  \displaystyle {d_F} = \left[ {\begin{array}{ccccccccccccccc} {0.3828} \\  {0.3328} \\   {0.05} \end{array}} \right] \times {10^{ - 5}}m $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

3. Find the Stresses in the Three Bars
Stresses in the elements.


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

$$  \displaystyle {\sigma ^e} = \frac\left[ {\begin{array}{ccccccccccccccc} { - \cos {\varphi ^e}}&{ - \sin {\varphi ^e}}&{\cos {\varphi ^e}}&{\sin {\varphi ^e}} \end{array}} \right]{d^e} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

For element 1 $$\varphi = {{-45}^o}$$
 * {| style="width:100%" border="0"

$$  \displaystyle {d^1} = \left[ {\begin{array}{ccccccccccccccc} \\   \\    \\ \end{array}} \right] = \left[ {\begin{array}{ccccccccccccccc} 0 \\  0 \\   {0.3328} \\   {0.05} \end{array}} \right] \times {10^{ - 5}} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


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

$$  \displaystyle {\sigma ^1} = \frac\left[ {\begin{array}{ccccccccccccccc} { - \frac{1}}&{\frac{1}}&{\frac{1}}&{ - \frac{1}} \end{array}} \right]\left[ {\begin{array}{ccccccccccccccc} 0 \\  0 \\   {0.3328} \\   {0.05} \end{array}} \right] \times {10^{ - 5}} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

For element 2 $$\varphi = {{-90}^o}$$
 * {| style="width:100%" border="0"

$$  \displaystyle {d^1} = \left[ {\begin{array}{ccccccccccccccc} \\   \\    \\ \end{array}} \right] = \left[ {\begin{array}{ccccccccccccccc} 0 \\  0 \\   {0.3328} \\   {0.05} \end{array}} \right] \times {10^{ - 5}} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


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

$$  \displaystyle {\sigma ^2} = \frac{1}\left[ {\begin{array}{ccccccccccccccc} 0&1&0&{ - 1} \end{array}} \right]\left[ {\begin{array}{ccccccccccccccc} 0 \\  0 \\   {0.3328} \\   {0.05} \end{array}} \right] \times {10^{ - 5}} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

For element 3 $$\varphi = {{-135}^o}$$
 * {| style="width:100%" border="0"

$$  \displaystyle {d^1} = \left[ {\begin{array}{ccccccccccccccc} \\   \\    \\ \end{array}} \right] = \left[ {\begin{array}{ccccccccccccccc} {0.3828} \\  0 \\   {0.3328} \\   {0.05} \end{array}} \right] \times {10^{ - 5}} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


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

$$  \displaystyle {\sigma ^3} = \frac\left[ {\begin{array}{ccccccccccccccc} {\frac{1}}&{\frac{1}}&{ - \frac{1}}&{ - \frac{1}} \end{array}} \right]\left[ {\begin{array}{ccccccccccccccc} {0.3828} \\  0 \\   {0.3328} \\   {0.05} \end{array}} \right] \times {10^{ - 5}} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

4. Find the reactions at nodes C, D and F
Reactions at node C(node 2),D(node 3) & F(node 1)


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

$$  \displaystyle {r_E} = {K_E}{\cancelto{0}{{\tilde d}_E}} + {K_{EF}}{d_F} $$     (6.5)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


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

$$  \displaystyle {r_E} = {K_{EF}}{d_F} $$     (6.6)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


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

$$  \displaystyle {r_E} = \left[ {\begin{array}{*{20}{c}} { - {{10}^3}} \\   \\   0 \\   { - {{10}^3}} \\   0 \end{array}} \right]Newton $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Now as element '3' is free to move in x direction so reaction $$$$ will be zero. Adding this element to $${r_E}$$ matrix.

=Problem 3.7: Rework Problem 3.1 without using a shift in the given polynomial basis.=

Given: A Polynomial Basis and a 2nd Order Formulation

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

$$  \displaystyle 2\frac{d^2u}{dx^2}+3=0 $$     (7.1)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

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

$$  \displaystyle u(x=1)=0 $$     (7.2)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle -\frac{du}{dx}(x=0)=4 $$     (7.3)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle b_j=(x)^j $$     (7.4) The exact solution to Eq.3.1:
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle u(x)=-\frac{3}{4}x^2-4x+\frac{19}{4} $$     (7.5)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

1. Two equations that enforce the boundary conditions for

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

$$  \displaystyle u^h(x)=\sum_{i=0}^n d_ib_i $$     (7.6)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

2. Find One More Linearly Independent Equation
Find one more equation to solve for in $$ \displaystyle {d} = \{d_i \}_{3x1} $$ such that $$ \displaystyle (j=0,1,2)$$ by projecting the residue $$ \displaystyle P(u^h) $$ onto the given polynomial basis function $$ \displaystyle b_k(x) $$ such that the additional equation is linearly independent of the original two equations.

3. Display in Matrix Form
Display these three equations in the matrix form Is the matrix $$ \displaystyle \underline{\mathbf{K}} $$ symmetric?

4. Solve for d
Solve the system of linear equations given by $$ \displaystyle \underline{\mathbf{K}} \mathbf{d}=\mathbf{f} $$ for $$ \displaystyle \mathbf{d} $$.

5. Construct and Plot the Approximate and Exact Solution for u(x)
Construct $$ \displaystyle u^h(x) $$ and plot $$ \displaystyle u^h(x) $$ versus $$ \displaystyle u(x) $$.

1. Find two equations that enforce the boundary conditions for

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

$$  \displaystyle u^h(x)=\sum_{i=0}^n d_ib_i $$     (7.6) First let's expand Eq.3.6 out to n=2 terms.
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle u^h(x)=d_0b_0+d_1b_1+d_2b_2 $$     (7.7) Now consider Eq.3.4, and substitute the appropriate terms into Eq.3.7.
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle u^h(x)=d_0(1)+d_1(x+1)+d_2(x+1)^2 $$     (7.8) Let's rewrite this equation in terms of a product between 2 vectors.
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle u^h(x)=\left[1\quad x\quad x^2\right ]\begin{bmatrix} d_0\\d_1\\d_2\end{bmatrix} $$     (7.9)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

3. Display in Matrix Form
In order for us to solve for the unknown $$d_i's$$ in Eq.3.9, we must have 3 linearly independent equations describing linear combinations of the $$d_i's.$$Two of the equations are easily obtained directly from the given boundary conditions in Eq.3.2 and Eq.3.3. It only makes practical sense that if we want our approximation to closely resemble our exact solution, we must require identical behavior between Eq.3.5 and Eq.3.8 at the boundaries.
 * {| style="width:100%" border="0"

$$  \displaystyle \begin{align} u^h(x=1)=d_0(1)+d_1(1)+d_2(1)^2&=0\\ d_0(1)+d_1(1)+d_2(1)^2&=0 \end{align} $$     (7.10)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

4. Solve for d

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

$$  \displaystyle \frac{du}{dx}(x=0)=d_1+d_22(0)=-4 $$     (7.12)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

2. Find One More Linearly Independent Equation
Now we just need one more linearly independent equation and we can then readily solve for the $$d_i's.$$ To develop another set of equations which are linearly independent of Eq.3.11 and Eq.3.13, we take the inner product between our approximation of u(x), Eq.3.9 and our basis set of functions Eq.3.4. Before getting to the inner product first, let's define our linear differential operator as the following
 * {| style="width:100%" border="0"

$$  \displaystyle P(\cdot)=\frac{d^2}{dx^2}+\frac{3}{2}=0 $$     (7.14) Now, using our operator in Eq.3.14, we can now operate on our approximation in Eq.3.9.
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle \begin{align} P(u^h)=\frac{d^2}{dx^2}\left[1\quad x\quad x^2\right ]\begin{bmatrix} d_0\\d_1\\d_2\end{bmatrix}+\frac{3}{2}&=0\\ \left[0\quad 0\quad 2\right ]\begin{bmatrix} d_0\\d_1\\d_2\end{bmatrix}+\frac{3}{2}&=0 \end{align} $$     (7.15) Which we can then rewrite Eq.3.15 as
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle \left[0\quad 0\quad 2\right ]\begin{bmatrix} d_0\\d_1\\d_2\end{bmatrix}=-\frac{3}{2} $$     (7.16)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

Now. let's check the absolute error between our approximate solution above in Eq. 7.26 and our exact solution in Eq.7.5. Comparing the solution to $$u(x)$$, 7.5, we can see that using this basis gives an exact solution to $$u(x)$$
 * {| style="width:100%" border="0"


 * style="width:92%; padding:10px; |
 * style="width:92%; padding:10px; |

$$  \displaystyle u^h(x)= \frac{19}{4}-4(x)-\frac{3}{4}(x)^2 $$     (7.14)
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle u(x)= \frac{19}{4}-4(x)-\frac{3}{4}(x)^2 $$     (7.5)
 * style="width:92%; padding:10px;|
 * style="width:92%; padding:10px;|
 * <p style="text-align:right">
 * }

1. Find two equations that enforce the boundary conditions
We will follow exactly the same methodology as we have above, leaving out the explanations for each step.
 * {| style="width:100%" border="0"

$$  \displaystyle u^h(x)=a_0b_0+a_1b_1+a_2b_2+a_3b_3+a_4b_4 $$     (7.32)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle u^h(x)=a_0(1)+a_1(x)+a_2(x)^2+a_3(x)^3+a_4(x)^4 $$     (7.33)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle u^h(x)=\begin{bmatrix}1 & x & x^2 & x^3 & x^4 \end{bmatrix}\begin{bmatrix}a_0\\a_1\\a_2\\a_3\\a_4 \end{bmatrix} $$     (7.34) Using our given boundary conditions to obtain our first 2 linearly independent equations.
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle \begin{align} u^h(x=1)&=a_0(1)+a_1(1)+a_2(1)^2+a_3(1)^3+a_4(1)^4\\ &=a_0+a_1+a_2+a_3+a_4 \end{align} $$     (7.35)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


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

$$  \displaystyle a_0+a_1+a_2+a_3+a_4=0 $$     (7.36)
 * style="width:92%; padding:10px; border:2px solid #8888aa" |
 * style="width:92%; padding:10px; border:2px solid #8888aa" |
 * <p style="text-align:right">
 * }


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

$$  \displaystyle \frac{du^h}{dx}(x=0)=0+a_1+0+0+0 $$     (7.37)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


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

$$  \displaystyle a_1=-4 $$     (7.38)
 * style="width:92%; padding:10px; border:2px solid #8888aa" |
 * style="width:92%; padding:10px; border:2px solid #8888aa" |
 * <p style="text-align:right">
 * }

2. Find One More Linearly Independent Equation
Using our predefined linear differential operator in Eq.7.14.
 * {| style="width:100%" border="0"

$$  \displaystyle P(u^h)=\frac{d^2}{dx^2}\begin{bmatrix}1 & x & x^2 & x^3 & x^4 \end{bmatrix}\begin{bmatrix}a_0\\a_1\\a_2\\a_3\\a_4 \end{bmatrix} + \frac{3}{2} $$     (7.39) Because this time we have 5 unknown $$a_i's,$$ we will have to choose 3 equations from our inner product operation.
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle \left \langle b_i,P(u^h) \right \rangle =\int_0^1b_iP(u^h)=0 $$     (7.40)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


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

$$  \displaystyle \int_0^1\begin{bmatrix}1\\x\\x^2\\x^3\\x^4\end{bmatrix}\begin{bmatrix}0 & 0 & 2 & 6(x) & 12(x)^2 \end{bmatrix}\,dx \begin{bmatrix}a_0\\a_1\\a_2\\a_3\\a_4\end{bmatrix}=-\frac{3}{2}\int_0^1\begin{bmatrix}1\\x\\x^2\\x^3\\x^4\end{bmatrix}\, dx $$ (7.41)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


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

$$  \displaystyle \int_0^1\begin{bmatrix} 0 & 0 & 2 & 6(x) & 12(x)^2\\ 0 & 0 & 2(x) & 6(x)^2 & 12(x)^3\\ 0 & 0 & 2(x)^2 & 6(x)^3 & 12(x)^4\\ 0 & 0 & 2(x)^3 & 6(x)^4 & 12(x)^5\\ 0 & 0 & 2(x)^4 & 6(x)^5 & 12(x)^6 \end{bmatrix}\,dx \begin{bmatrix}a_0\\a_1\\a_2\\a_3\\a_4\end{bmatrix}=-\frac{3}{2}\int_0^1\begin{bmatrix}1\\x\\x^2\\x^3\\x^4\end{bmatrix}\, dx $$ (7.42)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

3. Display in Matrix Form

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

$$  \displaystyle \begin{bmatrix} 0 & 0 & 2 & 3 & 4\\ 0 & 0 & 1 & 2 & 3\\                                       0 & 0 & 2/3 & 3/2 & 12/5\\                                         0 & 0 & 1/2 & 6/5 & 2\\                                         0 & 0 & 2/5 & 1 & 12/7 \end{bmatrix} \begin{bmatrix}a_0\\a_1\\a_2\\a_3\\a_4\end{bmatrix}=-\begin{bmatrix}3/2\\ 3/4 \\ 3/6 \\ 3/8 \\ 3/10 \end{bmatrix} $$     (7.43) Now we can use the bottom three rows of Eq.7.43, along with Eq.7.36 and Eq.7.38 to develop a system of equations
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle \begin{bmatrix} 1 & 1 & 1 & 1 & 1\\ 0 & 1 & 0 & 0 & 0\\                                       0 & 0 & 2/3 & 3/2 & 12/5\\                                         0 & 0 & 1/2 & 6/5 & 2\\                                         0 & 0 & 2/5 & 1 & 12/7 \end{bmatrix} \begin{bmatrix}a_0\\a_1\\a_2\\a_3\\a_4\end{bmatrix}=-\begin{bmatrix} 0 \\ 4 \\ 3/6 \\ 3/8 \\ 3/10 \end{bmatrix} $$     (7.44)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

4. Solve for d
Solving this system using MATLAB, the solution becomes
 * {| style="width:100%" border="0"

$$  \displaystyle \begin{bmatrix}a_0\\a_1\\a_2\\a_3\\a_4\end{bmatrix}=\begin{bmatrix} 19/4 \\ -4 \\ -3/4 \\ 0 \\ 0 \end{bmatrix} $$     (7.45)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

5. Construct and Plot the Approximate and Exact Solution for u(x)
We can see from above in Eq.7.46 that our solution did not improve at all by an increase in n from 2 to 4. This should have been intuitive from the start since we showed earlier that using n=2 gives us an equivalent $$u(x)$$

Graphical Comparison Between Exact and Numerical Approximate Solutions
Egm5526.s11.team-2.langpm 14:38, 14 February 2011 (UTC)

1. Find two equations that enforce the boundary conditions

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

$$  \displaystyle \begin{align} u^h(x) &= a_0b_0+a_1b_1+a_2b_2+a_3b_3+a_4b_4+a_5b_5+a_6b_6\\ &=a_0+a_1x+a_2x^2+a_3x^3+a_4x^4+a_5x^5+a_6x^6 \end{align} $$     (7.47) Using the given boundary conditions in Eq.7.2 and Eq.7.3 we have the following to restrictions on our approximated solution.
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle \begin{align} u^h(x=1)=&a_0+a_1+a_2+a_3+a_4+a_5+a_6=0\\ &a_0+a_1+a_2+a_3+a_4+a_5+a_6=0 \end{align} $$     (7.48)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


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

$$  \displaystyle a_0+a_1+a_2+a_3+a_4+a_5+a_6=0 $$     (7.49)
 * style="width:92%; padding:10px; border:2px solid #8888aa" |
 * style="width:92%; padding:10px; border:2px solid #8888aa" |
 * <p style="text-align:right">
 * }


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

$$  \displaystyle \frac{du^h}{dx}(x=0)=0+a_1+0+0+0+0+0 $$     (7.50)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


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

$$  \displaystyle a_1=-4 $$     (7.51) Using the same linear differential operator as we have for the past 2 cases, Eq.7.14 we have the following.
 * style="width:92%; padding:10px; border:2px solid #8888aa" |
 * style="width:92%; padding:10px; border:2px solid #8888aa" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle P(u^h)=\frac{d^2}{dx^2}\begin{bmatrix} 1 & x & x^2 & x^3 & x^4 & x^5 & x^6\end{bmatrix}\begin{bmatrix} a_0 \\ a_1 \\ a_2 \\ a_3 \\ a_4 \\ a_5 \\ a_6 \end{bmatrix} +\frac{3}{2} $$     (7.52)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

2. Find One More Linearly Independent Equation
Forming the inner product.
 * {| style="width:100%" border="0"

$$  \displaystyle \left \langle b_i,P(u^h) \right \rangle = \int_0^1 b_iP(u^h)\,dx = 0 $$     (7.53)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


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

$$  \displaystyle \int_0^1\begin{bmatrix} 0 & 0 & 2 & 6(x) & 12(x)^2 & 20(x)^3 & 30(x)^4\\ 0 & 0 & 2(x) & 6(x)^2 & 12(x)^3 & 20(x)^4 & 30(x)^5\\ 0 & 0 & 2(x)^2 & 6(x)^3 & 12(x)^4 & 20(x)^5 & 30(x)^6\\ 0 & 0 & 2(x)^3 & 6(x)^4 & 12(x)^5 & 20(x)^6 & 30(x)^7\\ 0 & 0 & 2(x)^4 & 6(x)^5 & 12(x)^6 & 20(x)^7 & 30(x)^8\\ 0 & 0 & 2(x)^5 & 6(x)^6 & 12(x)^7 & 20(x)^8 & 30(x)^9\\ 0 & 0 & 2(x)^6 & 6(x)^7 & 12(x)^8 & 20(x)^9 & 30(x)^{10}\end{bmatrix}\, dx \begin{bmatrix} a_0 \\ a_1 \\ a_2 \\ a_3 \\ a_4 \\ a_5 \\ a_6 \end{bmatrix}=-\frac{3}{2} \int_0^1 \begin{bmatrix} 1 \\ x \\ (x)^2 \\ (x)^3 \\ (x)^4 \\ (x)^5 \\ (x)^6 \end{bmatrix} $$     (7.54)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


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

$$  \displaystyle \begin{bmatrix} 0 & 0 & 2 & 3 & 4 & 5 & 6\\ 0 & 0 & 1 & 2 & 3 & 4 & 5\\ 0 & 0 & 2/3 &  3/2 & 12/5 &  10/3 &   30/7\\ 0 & 0 &  1/2  & 6/5 &    2 &  20/7 &   15/2\\ 0 & 0 &  2/5 &  1 & 12/7 &  5/2 &     10/3\\ 0 & 0 &  1/3 & 6/7 &  3/2 & 20/9 &  3\\ 0 & 0 & 2/7 & 3/4 & 4/3 &  1/2 & 30/11\end{bmatrix}\begin{bmatrix} a_0\\ a_1\\ a_2\\ a_3\\ a_4\\ a_5\\ a_6\end{bmatrix}=\begin{bmatrix} -3/2\\   -3/4\\    -3/6\\   -3/8\\  -3/10\\   -3/12\\ -3/14\end{bmatrix} $$     (7.55) We take the bottom 5 rows from Eq.7.55 and build a system of equations with Eq.7.49 and Eq.7.51.
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle \begin{bmatrix} 1 & 1 & 1 & 1 & 1 & 1 & 1\\ 0 & 1 & 0 & 0 & 0 & 0 & 0\\ 0 & 0 & 2/3 &  3/2 & 12/5 &  10/3 &   30/7\\ 0 & 0 &  1/2  & 6/5 &    2 &  20/7 &   15/2\\ 0 & 0 &  2/5 &  1 & 12/7 &  5/2 &     10/3\\ 0 & 0 &  1/3 & 6/7 &  3/2 & 20/9 &  3\\ 0 & 0 & 2/7 & 3/4 & 4/3 &  1/2 & 30/11\end{bmatrix}\begin{bmatrix} a_0\\ a_1\\ a_2\\ a_3\\ a_4\\ a_5\\ a_6\end{bmatrix}=\begin{bmatrix} 0\\   -4\\     -3/6\\   -3/8\\  -3/10\\   -3/12\\ -3/14\end{bmatrix} $$     (7.56)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

4. Solve for d
As in the $$n=4$$ case, we use a MATLAB to determine the unknown $$ a_i's$$ adn to determine the final form of our approximation to the solution of the differential equation 7.1.
 * {| style="width:100%" border="0"

$$  \displaystyle \begin{bmatrix} a_0 \\ a_1 \\ a_2 \\ a_3 \\ a_4 \\ a_5 \\ a_6 \end{bmatrix}=\begin{bmatrix} 19/4 \\ -4 \\ -3/4 \\ 0 \\ 0 \\ 0 \\ 0 \end{bmatrix} $$     (7.57)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

5. Construct and Plot the Approximate and Exact Solution for u(x)
We can see from above in Eq.7.58 that our solution did not improve at all by an increase in n from 2 to 6 as was expected. Comparing this to the results from problem 3.1 we can see that the shift is not necessary for this basis function. It will return an exact solution with or without the shift.

Graphical Comparison Between the Exact and Numerical Solutions


=Problem 3.8: Develop the Weak Form for the Strong Form (F&B Problem 3.1)=

Given
Show that the weak form of:

on 1 < x < 3

is given by

Solution
Equations 8.2 and 8.3 are natural and essential boundary conditions, respectively. Since the weight function must vanish with essential boundaries, consider all smooth weight functions so that w(3)=0.

Multiply w to the first part of Equ 8.1 and integrate all of Equ 8.1 over the domain of 1 to 3:

and multiplying the natural boundary condition by wA:

Evaluating the left hand side of Equ 8.6 using integration by parts:

Since w(3)=0, the integral evaluated at 3 falls out and adding in the second part of Equ 8.6:

Substituting Equ 8.8 into Equ 8.11 and rearranging:

Rearranging once more, the equation is identical to Equ 8.4:

=Problem 3.9: Using Linear Trial Solutions in the Strong Form and Weak Form=

Given
Using the strong form

with the natural and essential boundary conditions, respectively shown here

with a trial solution $$ \displaystyle u(x) $$ and weight function $$\displaystyle w(x) $$ of the form

Where $$ \displaystyle \alpha_0 $$ and $$ \displaystyle \alpha_1 $$ are unknown parameters and $$ \displaystyle \beta_0 $$ and $$ \displaystyle \beta_1 $$ are arbitrary parameters.

Find
1. Find a solution to the weak form

2. Determine if the equilibrium equation in the strong form is satisfied.

3. Determine if the natural boundary condition is satisfied.

Solution to 3.9.1: Obtaining a Solution to the Weak Form
First we will consider the weight function $$ \displaystyle w(x) $$ which must vanish on the essential boundary provided in the problem statement. Similarly, the trial solution $$ \displaystyle u(x) $$ must satisfy the essential boundary condition Furthermore, we can assert that there is only one unknown parameter and arbitrary parameter since (9.7) and (9.8) directly imply Next we will substitute the trial solutions and the weight functions shown in (9.7),(9.8) and derivatives shown in (9.9) into the weak form (9.6) to obtain In the next step we will evaluate the integral in (9.10) to get Since (9.11) holds for any $$ \displaystyle \beta_1 $$ then $$ \displaystyle \alpha_1 $$ is

Substituting the result of (9.12) in to the linear trial solution (9.8) denoted by $$ \displaystyle u^{lin}(x) $$ we obtain the approximate solution

Solution to 3.9.2: Determine if the Equilibrium Condition in the Strong Form is Satisfied
The strong form is

Substituting the approximate solution shown in (9.13) in to the strong form shown in (9.1) gives

But this implies that

The value $$ \displaystyle x=0 $$ does not belong to our domain defined on $$ \displaystyle 1 < x < 3 $$. Therefore, the equilibrium condition is not satisfied since it must be at least second order or higher differentiable.

Solution to 3.9.3: Determine if the Natural Boundary Condition is Satisfied
Let us see if this satisfies the natural boundary condition given in (9.2)

Clearly, this does not satisfy the natural boundary condition which is not necessary since the condition in and of itself is only sufficient. Instead it is ONLY necessary that it satisfy the essential boundary condition as was stated in Lecture 15-2.

=Problem 3.10: Obtaining Solution to the Weak Form from a Trial Solution=

Given
where the weak form is A trial solution for u(x) is suggested as with w(x) of the same form. 1) determine the solution to the weak form. 2) is equilibrium equation of the strong form satisfied 3) is the natural boundary condition satisfied

Solution 3.10.1
From the given information the equations for u(x) and w(x) are as follows Using the initial condition $$w(3)=0$$ Using the condition that $$u(3)=0.001$$ The partial derivatives of u(x) and w(x) are Replacing, the weak form becomes After integration the equation becomes Rearranging we get The $$\beta _0$$ and $$\beta_1$$ values must be arbitrary, the solutions to this equation are dependent on the bracketed terms equaling zero. The solution for this, in matrix form, is The solution to the weak form becomes Giving the solution of

Solution to 3.10.2
The equilibrium condition in the strong form is shown in equation (10.1). Replacing with the determined values we get, The solution is not valid for every x on the given interval. It is only valid when

Solution to 3.10.3
The natural boundary condition as given by equation (10.2) is Replacing with know values we get This reduces to This does not equal the natural boundary condition that $$\sigma(1)=.1$$ unless $$A=\frac{10}{9}$$

=Problem 3.11:Solving Hw2.9 with fourier basis=

Fourier Basis Functions
For getting approximate solution for dataset 2 given in meeting 12-1 now we can take fourier series family as a basis functions. Family of fourier functions are given in meeting 10-1.


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

$$  \displaystyle f(x)=\alpha _{0}+\sum_{i}^{\infty }\alpha _{i}cosiwx+\sum_{i}^{\infty }\beta _{i}siniwx $$     (11.1) Where
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


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

$$  \displaystyle w=\frac{2\Pi }{T} $$     (11.2) Fourier basis functions $$\displaystyle \left \{ b_{1},......,b_{n} \right \}=\left \{ 1,coswx,sinwx,cos2wx,sinwx,...... \right \} $$.These basis fuctions are linealy independent i.e. their determinant of gram matrix is not equal to zero. And these functions are periodic functions.
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

We can take basis functions where $$ \displaystyle w=1 $$

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

$$  \displaystyle \left \{ 1,cosx,sinx,cos2x,sin2x,.... \right \} $$     (11.3)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

Dataset and P(u)
Problem statement is given as :


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

$$  \displaystyle \Omega =\left] 0,1 \right[ $$     (11.4)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


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

$$  \displaystyle a_{2}=2 $$     (11.5)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle f=3 $$     (11.6)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle \frac{\partial^2 u(x,t)}{\partial x^2}=0 $$     (11.7)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle \Gamma _{g}={1},g=0 $$     (11.8)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle \Gamma _{h}={0},h=4 $$     (11.9)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle P(u):=\frac{\partial }{\partial x}\left[ {{a}_{2}}(x)\frac{\partial u}{\partial x} \right]+f(x,t)-m\frac{{{\partial }^{2}}u}{{{\partial }^{2}}x} $$     (11.10)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

Exact Solution

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

$$  \displaystyle P(u)=\frac{\partial u}{\partial x}\left[ 2\frac{\partial u}{\partial x} \right]+3-0=0 $$     (11.11)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle 2\frac{\partial u}{\partial x}=-\int 3dx $$     (11.12)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle \frac{\mathrm{d} u}{\mathrm{d} x}=-\frac{3}{2}x+c $$     (11.13)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle -\frac{du(x=0)}{dx}=4 $$     (11.14)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle \frac{\mathrm{d} u}{\mathrm{d} x}=-\frac{3}{2}x-4 $$     (11.15)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle u(x)=-\frac{3x^2}{4}-4x+c_{2} $$     (11.16)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle u(x=1)=0 $$     (11.17)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle u(x)=-\frac{3x^2}{4}-4x+\frac{19}{4} $$     (11.18)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

n=3

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

$$  \displaystyle\begin{align} & b_{1}(x)=1 \\ & b_{2}(x)=cosx \\ & b_{3}(x)=sinx \\ \end{align} $$ (11.19)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


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

$$  \displaystyle\begin{align} u^{h}(x) & =\sum_{j=1}^{3}d_{j}b_{j}(x) \\ & =d_{1}+d_{2}cosx+d_{3}sinx \\ \end{align} $$     (11.20)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

Now we can use our boundry conditions to observe 2 equations;


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

$$  \displaystyle u^{h}(x=1)=0 $$     (11.21)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle d_{1}+d_{2}cos(1)+d_{3}sin(1)=0 $$     (11.22)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


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

$$  \displaystyle \frac{du^{h}(x=0)}{dx}=-4 $$     (11.23)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle 0+d_{3}=-4 $$     (11.24)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

After obtaining 2 equations by applying boundry conditions we need one more equation. We can get it from projection


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

$$  \displaystyle \int_{\Omega }b_{k}(x).P(u^{h}(x))dx=0,k=1,2,3 $$     (11.25) Lets take k=1 for our convenience
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


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

$$  \displaystyle\begin{align} P(u^{h}(x)) & =\frac{d}{dx}\left [ 2\frac{d}{dx}\left ( d_{1}+d_{2}cos(x)+d_{3}sin(x) \right ) \right ]+3 \\ & =-2d_{2}cos(x)-2d_{3}sin(x)+3 \\ \end{align} $$ (11.26)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


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

$$  \displaystyle \int_{\Omega }1*\left ( -2d_{2}cos(x)-2d_{3}sin(x)+3 \right )dx=0 $$     (11.27)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


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

$$  \displaystyle -2d_{2}sin(1)+2d_{3}(cos(1)-cos(0))+3=0 $$     (11.28)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


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

$$  \displaystyle \left[ \begin{matrix} \begin{matrix} 1 \\   0  \\   0  \\ \end{matrix} & \begin{matrix} \cos (1) \\ 0 \\   -2\sin (1)  \\ \end{matrix} & \begin{matrix} \sin (1) \\ 1 \\   2(\cos (1)-\cos (0))  \\ \end{matrix} \\ \end{matrix} \right]\left[ \begin{matrix} {{d}_{1}} \\ {{d}_{2}} \\ {{d}_{3}} \\ \end{matrix} \right]=\left[ \begin{matrix} 0 \\   -4  \\   -3  \\ \end{matrix} \right] $$     (11.29)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle \begin{matrix} {{d}_{1}}=1.2221 \\ {{d}_{2}}=3.9678 \\ {{d}_{3}}=-4 \\ \end{matrix}
 * style="width:95%" |
 * style="width:95%" |

$$     (11.30)
 * <p style="text-align:right">
 * }


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

$$  \displaystyle u^{h}(x)=1.2221+3.9678cos(x)-4sin(x) $$     (11.31)
 * style="width:92%; padding:10px; border:2px solid #8888aa" |
 * style="width:92%; padding:10px; border:2px solid #8888aa" |
 * <p style="text-align:right">
 * }



n=5
Now our new members from the family of fourier series are:


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

$$  \displaystyle f(x)=\left \{ 1,cos(x),sin(x),cos(2x),sin(2x) \right \} $$     (11.32)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


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

$$  \displaystyle u^{h}(x)=\sum_{i=1}^{5}d_{j}b_{j}(x) $$     (11.33)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle u^{h}(x)=d_{1}.1+d_{2}cos(x)+d_{3}sin(x)+d_{4}cos(2x)+d_{5}sin(2x) $$     (11.34) Applying boundry conditions yields
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle u^{h}(x=1)=0 $$     (11.35)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle d_{1}+d_{2}cos(1)+d_{3}sin(1)+d_{4}cos(2)+d_{5}sin(2)=0 $$     (11.36)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle \frac{du^{h}(x=0)}{dx}=-4 $$     (11.37)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle \frac{du^{h}(x)}{dx}=-d_{2}sin(x)+d_{3}cos(x)-2d_{4}sin(2x)+2d_{5}cos(2x) $$     (11.38)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle d_{3}+2d_{5}=-4 $$     (11.39) Now we can project our function on our basis functions to get more equations.
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle \int_{\Omega }b_{k}P(u^{h}(x))dx=0 $$     (11.40)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle\begin{align} P(u^{h}(x)) &=\frac{d}{dx}\left [ 2\frac{d}{dx}\left ( d_{1}+d_{2}cos(x)+d_{3}sin(x)+d_{4}cos(2x)+d_{5}sin(2x) \right ) \right ]+3 \\ &=\left ( -2d_{2}cos(x)-2d_{3}sin(x)-8d_{4}cos(2x)-8d_{5}sin(2x) \right )+3 \\ \end{align}$$ (11.41)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

$$ \displaystyle k=1$$ where $$ \displaystyle b_{1}=1 $$


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

$$  \displaystyle \begin{align} \int_{\Omega }b_{1}P(u^{h})dx &=\int_{\Omega }1.(-2d_{2}cos(x)-2d_{3}sin(x)-8d_{4}cos(2x)-8d_{5}sin(2x)+3)dx \\ &=-2d_{2}sin(1)+2d_{3}(cos(1)-cos(0))-4d_{4}sin(2)+4d_{5}(cos(2)-cos(0))+3 \\ &=0 \\ \end{align}$$ (11.42) $$ \displaystyle k=2$$  where $$ \displaystyle b_{2}=cos(x) $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle \begin{align} \int_{\Omega }b_{2}P(u^{h})dx &=\int_{\Omega }cos(x).(-2d_{2}cos(x)-2d_{3}sin(x)-8d_{4}cos(2x)-8d_{5}sin(2x)+3)dx \\ &=-2d_{2}\int_{\Omega }cos(x)^2dx-2d_{3}\int_{\Omega }sin(x)cos(x)dx-8d_{4}\int_{\Omega }cos(2x)cos(x)dx-8d_{5}\int_{\Omega }sin(2x)cos(x)dx+3\int_{\Omega }cos(x)dx \\ &=-d_{2}(1+sin(1)cos(1))+d_{3}(cos^2(1)-cos^2(0))-\frac{4}{3}d_{4}(3sin(1)+sin(3))+\frac{16d_{5}}{3}(cos^3(1)-cos^3(0))+3sin(1) \\ &=0 \\
 * style="width:95%" |
 * style="width:95%" |

\end{align}$$ (11.43)
 * <p style="text-align:right">
 * }

$$ \displaystyle k=3$$ where $$ \displaystyle b_{3}=sin(x) $$
 * {| style="width:100%" border="0"

$$  \displaystyle\begin{align} \int_{\Omega }b_{3}P(u^{h})dx &=\int_{\Omega }cos(x).(-2d_{2}cos(x)-2d_{3}sin(x)-8d_{4}cos(2x)-8d_{5}sin(2x)+3)dx \\ &=-2d_{2}\int_{\Omega }sin(x)cos(x)dx-2d_{3}\int_{\Omega }sin^2(x)dx-8d_{4}\int_{\Omega }sin(x)cos(2x)dx-8d_{5}\int_{\Omega }sin(x)sin(2x)dx+3\int_{\Omega }sin(x)dx \\ &=d_{2}(cos^2(1)-cos^2(0))-d_{3}(1-sin(1)cos(1))-\frac{4}{3}d_{4}(3cos(1)-cos(3)-2cos(0))-\frac{16}{3}d_{5}sin^3(1)-3(cos(1)-cos(0)) \\ &=0 \\ \end{align}$$ (11.44)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


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

$$  \displaystyle \left[ \begin{matrix} \begin{matrix} \begin{matrix} \begin{matrix} 1 \\   0  \\ \end{matrix}  \\ 0 \\   0  \\   0  \\ \end{matrix} & \begin{matrix} \begin{matrix} \cos (1) \\ 0 \\ \end{matrix}  \\ -2\sin (1) \\ -(1+\sin (1)\cos (1)) \\ (\cos \hat{\ }2(1)-\cos \hat{\ }2(0)) \\ \end{matrix} \\ \end{matrix} & \begin{matrix} \begin{matrix} \sin (1) \\ 1 \\ \end{matrix}  \\ 2(\cos (1)-\cos (0)) \\ \cos \hat{\ }2(1)-\cos \hat{\ }2(0) \\ -(1-\sin (1)\cos (1)) \\ \end{matrix} & \begin{matrix} \begin{matrix} \cos (2) \\ 0 \\ \end{matrix}  \\ -4\sin (2) \\ -\frac{4}{3}(3\sin (1)+\sin (3)) \\ -\frac{4}{3}(3\cos (1)-\cos (3)-2\cos (0)) \\ \end{matrix} & \begin{matrix} \begin{matrix} \sin (2) \\ 2 \\ \end{matrix}  \\ 4(\cos (2)-\cos (0)) \\ \frac{16}{3}(\cos \hat{\ }3(1)-\cos \hat{\ }3(0)) \\ -\frac{16}{3}\sin \hat{\ }3(1) \\ \end{matrix} \\ \end{matrix} \right]\left[ \begin{matrix} \begin{matrix} {{d}_{1}} \\ {{d}_{2}} \\ \end{matrix} \\ {{d}_{3}} \\ {{d}_{4}} \\ {{d}_{5}} \\ \end{matrix} \right]=\left[ \begin{matrix} \begin{matrix} 0 \\   -4  \\ \end{matrix}  \\ -3 \\   -3\sin (1)  \\ 3(\cos (1)-\cos (0)) \\ \end{matrix} \right]
 * style="width:95%" |
 * style="width:95%" |

$$     (11.45)
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle \underline{d}=\left[ \begin{matrix} \begin{matrix} -4.1772 \\   10.7337  \\ \end{matrix}  \\ -1.3753 \\   -1.7502  \\   -1.3123  \\ \end{matrix} \right]
 * style="width:95%" |
 * style="width:95%" |

$$     (11.46)
 * <p style="text-align:right">
 * }


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

$$  \displaystyle u^{h}(x)=-4.1772+10.7337cos(x)-1.3753sin(x)-1.7502cos(2x)-1.3123sin(2x) $$     (11.47)
 * style="width:92%; padding:10px; border:2px solid #8888aa" |
 * style="width:92%; padding:10px; border:2px solid #8888aa" |
 * <p style="text-align:right">
 * }



n=7

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

$$  \displaystyle f(x)=\left \{ 1,cos(x),sin(x),cos(2x),sin(2x),cos(3x),sin(3x) \right \} $$     (11.48)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


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

$$  \displaystyle u^{h}(x)=\sum_{i=1}^{7}d_{j}b_{j}(x) $$     (11.49)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle u^{h}(x)=d_{1}.1+d_{2}cos(x)+d_{3}sin(x)+d_{4}cos(2x)+d_{5}sin(2x)+d_{6}cos(3x)+d_{7}sin(3x) $$     (11.50)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

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

$$  \displaystyle u^{h}(x=1)=0 $$     (11.51)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle d_{1}+d_{2}cos(1)+d_{3}sin(1)+d_{4}cos(2)+d_{5}sin(2)+d_{6}cos(3)+d_{7}sin(3)=0 $$     (11.52)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle \frac{du^{h}(x=0)}{dx}=-4 $$     (11.53)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle \frac{du^{h}(x)}{dx}=-d_{2}sin(x)+d_{3}cos(x)-2d_{4}sin(2x)+2d_{5}cos(2x)-3d_{6}sin(3x)+3d_{7}cos(3x) $$     (11.54)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle d_{3}+2d_{5}+3d_{7}=-4 $$     (11.55) Now we can start with projections
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle \int_{\Omega }b_{k}P(u^{h}(x))dx=0 $$     (11.56)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle\begin{align} P(u^{h}(x)) &=\frac{d}{dx}\left [ 2\frac{d}{dx}\left ( d_{1}+d_{2}cos(x)+d_{3}sin(x)+d_{4}cos(2x)+d_{5}sin(2x)+d_{6}cos(3x)+d_{7}sin(3x) \right ) \right ]+3 \\ &=\left ( -2d_{2}cos(x)-2d_{3}sin(x)-8d_{4}cos(2x)-8d_{5}sin(2x)-18d_{6}cos(3x)-18d_{7}sin(3x) \right )+3 \\ \end{align}$$ (11.57) $$ \displaystyle k=1$$  where $$ \displaystyle b_{1}=1 $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


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

$$  \displaystyle \begin{align} \int_{\Omega }b_{1}P(u^{h})dx &=\int_{\Omega }1.(-2d_{2}cos(x)-2d_{3}sin(x)-8d_{4}cos(2x)-8d_{5}sin(2x)-18d_{6}cos(3x)-18d_{7}sin(3x)+3)dx \\ &=-2d_{2}sin(1)+2d_{3}(cos(1)-cos(0))-4d_{4}sin(2)+4d_{5}(cos(2)-cos(0))-6d_{6}sin(3)+6d_{7}(cos(3)-cos(0))+3 \\ &=0 \\ \end{align}$$ (11.58)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

$$ \displaystyle k=2$$ where $$ \displaystyle b_{2}=cos(x) $$
 * {| style="width:100%" border="0"

$$  \displaystyle \begin{align} \int_{\Omega }b_{2}P(u^{h})dx &=\int_{\Omega }cos(x).(-2d_{2}cos(x)-2d_{3}sin(x)-8d_{4}cos(2x)-8d_{5}sin(2x)-18d_{6}cos(3x)-18d_{7}sin(3x)+3)dx \\ &=-2d_{2}\int_{\Omega }cos(x)^2dx-2d_{3}\int_{\Omega }sin(x)cos(x)dx-8d_{4}\int_{\Omega }cos(2x)cos(x)dx-8d_{5}\int_{\Omega }sin(2x)cos(x)dx \\ & -18d_{6}\int_{\Omega }cos(3x)cos(x)dx-18d_{7}\int_{\Omega }sin(3x)cos(x)dx+3\int_{\Omega }cos(x)dx \\ &=-d_{2}(1+sin(1)cos(1))+d_{3}(cos^2(1)-cos^2(0))-\frac{4}{3}d_{4}(3sin(1)+sin(3)) \\ &+\frac{16d_{5}}{3}(cos^3(1)-cos^3(0))-18d_{6}(sin(1)cos^3(1))+\frac{9}{4}d_{7}(4cos^2(1)+cos(4)-4cos^2(0)-cos(0))+3sin(1) \\ &=0 \\
 * style="width:95%" |
 * style="width:95%" |

\end{align}$$ (11.59)
 * <p style="text-align:right">
 * }

$$ \displaystyle k=3$$ where $$ \displaystyle b_{3}=sin(x) $$
 * {| style="width:100%" border="0"

$$  \displaystyle\begin{align} \int_{\Omega }b_{3}P(u^{h})dx &=\int_{\Omega }cos(x).(-2d_{2}cos(x)-2d_{3}sin(x)-8d_{4}cos(2x)-8d_{5}sin(2x)-18d_{6}cos(3x)-18d_{7}sin(3x)+3)dx \\ &=-2d_{2}\int_{\Omega }sin(x)cos(x)dx-2d_{3}\int_{\Omega }sin^2(x)dx-8d_{4}\int_{\Omega }sin(x)cos(2x)dx-8d_{5}\int_{\Omega }sin(x)sin(2x)dx \\ &-18d_{6}\int_{\Omega }sin(x)cos(3x)dx-18d_{7}\int_{\Omega }sin(x)sin(3x)dx+3\int_{\Omega }sin(x)dx \\ &=d_{2}(cos^2(1)-cos^2(0))-d_{3}(1-sin(1)cos(1))-\frac{4}{3}d_{4}(3cos(1)-cos(3)-2cos(0))-\frac{16}{3}d_{5}sin^3(1) \\ &-\frac{9}{4}d_{6}(4cos^2(1)-cos(4)-4cos^2(0)+cos(0))-18d_{7}(sin^3(1)cos(1))-3(cos(1)-cos(0)) \\ &=0 \\ \end{align}$$ (11.60)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

$$ \displaystyle k=4$$ where $$ \displaystyle b_{4}=cos(2x) $$
 * {| style="width:100%" border="0"

$$  \displaystyle\begin{align} \int_{\Omega }b_{4}P(u^{h})dx &=\int_{\Omega }cos(2x).(-2d_{2}cos(x)-2d_{3}sin(x)-8d_{4}cos(2x)-8d_{5}sin(2x)-18d_{6}cos(3x)-18d_{7}sin(3x)+3)dx \\ &=-2d_{2}\int_{\Omega }cos(2x)cos(x)dx-2d_{3}\int_{\Omega }sin(x)cos(2x)dx-8d_{4}\int_{\Omega }cos^2(2x)dx-8d_{5}\int_{\Omega }cos(2x)sin(2x)dx \\ &-18d_{6}\int_{\Omega }cos(2x)cos(3x)dx-18d_{7}\int_{\Omega }cos(2x)sin(3x)dx+3\int_{\Omega }cos(2x)dx \\ &=-\frac{d_{2}}{3}(3sin(1)+sin(3))-\frac{d_{3}}{3}(3cos(1)-cos(3)-2cos(0))-d_{4}(4+sin(4))+d_{5}(cos(4)-cos(0)) \\ &-\frac{9}{5}d_{6}(5sin(1)-sin(5))+\frac{9}{5}d_{7}(5cos(1)+cos(5)-6cos(0))+\frac{3}{2}sin(2) \\ &=0 \\ \end{align}$$ (11.61)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

$$ \displaystyle k=5$$ where $$ \displaystyle b_{5}=sin(2x) $$
 * {| style="width:100%" border="0"

$$  \displaystyle\begin{align} \int_{\Omega }b_{5}P(u^{h})dx &=\int_{\Omega }sin(2x).(-2d_{2}cos(x)-2d_{3}sin(x)-8d_{4}cos(2x)-8d_{5}sin(2x)-18d_{6}cos(3x)-18d_{7}sin(3x)+3)dx \\ &=-2d_{2}\int_{\Omega }sin(2x)cos(x)dx-2d_{3}\int_{\Omega }sin(x)sin(2x)dx-8d_{4}\int_{\Omega }cos(2x)sin(2x)dx-8d_{5}\int_{\Omega }sin^2(2x)dx \\ &-18d_{6}\int_{\Omega }sin(2x)cos(3x)dx-18d_{7}\int_{\Omega }sin(2x)sin(3x)dx+3\int_{\Omega }sin(2x)dx \\ &=\frac{4}{3}d_{2}(cos^3(1)-cos^3(0))-\frac{4}{3}d_{3}sin^3(1)+d_{4}(cos(4)-cos(0))-d_{5}(4-sin(4)) \\ &-\frac{9}{5}d_{6}(5cos(1)-cos(5)-4cos(0))-\frac{36}{5}d_{7}(sin^3(1)(2cos(2)+3))-\frac{3}{2}(cos(2)-cos(0)) \\ &=0 \\ \end{align}$$ (11.62)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"


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

$$  \displaystyle \left[ \begin{matrix} \begin{matrix} \begin{matrix} \begin{matrix} \begin{matrix} \begin{matrix} 1 \\   0  \\ \end{matrix}  \\ 0 \\   0  \\ \end{matrix}  \\ 0 \\   0  \\   0  \\ \end{matrix} & \begin{matrix} \begin{matrix} \begin{matrix} \cos (1) \\ 0 \\ \end{matrix}  \\ -2\sin (1) \\ -(1+\cos (1)\sin (1)) \\ \end{matrix} \\ \cos \hat{\ }2(1)-\cos \hat{\ }2(0) \\ -\frac{1}{3}(3\sin (1)+\sin (3)) \\ \frac{4}{3}(\cos \hat{\ }3(1)-\cos \hat{\ }3(0)) \\ \end{matrix} \\ \end{matrix} & \begin{matrix} \begin{matrix} \begin{matrix} \sin (1) \\ 1 \\ \end{matrix}  \\ 2(\cos (1)-\cos (0)) \\ \cos \hat{\ }2(1)-\cos \hat{\ }2(0) \\ \end{matrix} \\ -(1-\sin (1)\cos (1)) \\ -\frac{1}{3}(3\cos (1)-\cos (3)-\cos (0)) \\ -\frac{4}{3}\sin \hat{\ }3(1) \\ \end{matrix} & \begin{matrix} \begin{matrix} \begin{matrix} \cos (2) \\ 0 \\ \end{matrix}  \\ -4\sin (2) \\ -\frac{4}{3}(3\sin (1)+\sin (3)) \\ \end{matrix} \\ -\frac{4}{3}(3\cos (1)-\cos (3)-2\cos (0)) \\ 4+\sin (4) \\ \cos (4)-\cos (0) \\ \end{matrix} \\ \end{matrix} & \begin{matrix} \begin{matrix} \begin{matrix} \sin (2) \\ 2 \\ \end{matrix}  \\ 4(\cos (2)-\cos (0)) \\ \frac{16}{3}(\cos \hat{\ }3(1)-\cos \hat{\ }3(0)) \\ \end{matrix} \\ -\frac{16}{3}\sin \hat{\ }3(1) \\ \cos (4)-\cos (0) \\ 4-\sin (4) \\ \end{matrix} & \begin{matrix} \begin{matrix} \begin{matrix} \cos (3) \\ 0 \\   -6\sin (3)  \\ \end{matrix} \\ -18\sin (1)\cos \hat{\ }3(1) \\ \end{matrix} \\ -\frac{9}{4}(4\cos \hat{\ }2(1)-\cos (4)-4\cos \hat{\ }2(0)+\cos (0)) \\ -\frac{9}{5}(5\sin (1)-\sin (5)) \\ -\frac{9}{5}(5\cos (1)-\cos (5)-4\cos (0)) \\ \end{matrix} & \begin{matrix} \begin{matrix} \begin{matrix} \sin (3) \\ 3 \\ \end{matrix}  \\ 6(\cos (3)-\cos (0)) \\ \frac{9}{4}(4\cos \hat{\ }2(1)+\cos (4)-4\cos \hat{\ }2(0)-\cos (0)) \\ \end{matrix} \\ -18\sin \hat{\ }3(1)\cos (1) \\ \frac{9}{5}(5\cos (1)+\cos (5)-6\cos (0)) \\ -\frac{36}{5}\sin \hat{\ }3(1)(2\cos (2)+3) \\ \end{matrix} \\ \end{matrix} \right] $$     (11.63)
 * <p style="text-align:right">
 * }


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

$$  \displaystyle \underline{d}=\left[ \begin{matrix} \begin{matrix} \begin{matrix} 14.6952 \\   -13.6724  \\ \end{matrix}  \\ -15.411 \\   3.727  \\ \end{matrix}  \\ 8.1873 \\   0.0003  \\   -1.6545  \\ \end{matrix} \right] $$     (11.64)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle u^{h}(x)=14.6952-13.6724cos(x)-15.411sin(x)+3.727cos(2x)+8.1873sin(2x)+0.0003cos(3x)-1.6545sin(3x) $$     (11.65)
 * style="width:92%; padding:10px; border:2px solid #8888aa" |
 * style="width:92%; padding:10px; border:2px solid #8888aa" |
 * <p style="text-align:right">
 * }



Comment

As we can see from the graphs when we take more components from the family the approximate solution becomes more close to exact solution. Actually for 7 components we can say that our approximation is very good for the problem so more components would nothing but more work.

=Contributing Members & Referenced Lecture=

=References=