User:Egm6321.f10.team2.oztekin/Newww

=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%" |
 * 
 * }


 * {| 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%" |
 * 
 * }

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%" |
 * 
 * }

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%" |
 * 
 * }


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

$$  \displaystyle a_{2}=2 $$     (11.5)
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle f=3 $$     (11.6)
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }
 * {| style="width:100%" border="0"

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

$$  \displaystyle \Gamma _{g}={1},g=0 $$     (11.8)
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle \Gamma _{h}={0},h=4 $$     (11.9)
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }
 * {| 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%" |
 * 
 * }

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%" |
 * 
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle 2\frac{\partial u}{\partial x}=-\int 3dx $$     (11.12)
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }
 * {| 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%" |
 * 
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle -\frac{du(x=0)}{dx}=4 $$     (11.14)
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }
 * {| 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%" |
 * 
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle u(x)=-\frac{3x^2}{4}-4x+c_{2} $$     (11.16)
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }
 * {| 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:95%" |
 * style="width:95%" |
 * <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:95%" |
 * style="width:95%" |
 * <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:95%" |
 * style="width:95%" |
 * <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.