University of Florida/Eml5526/s11.team2.reiss.HW3 HW3

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) verify that the solution satisfies the equilibrium equation of the strong form 3) verify that the natural boundary condition is 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

Given

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

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

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

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

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

Find
We want to find an approximation to Eq.3.5 in the form of
 * {| style="width:100%" border="0"

$$  \displaystyle u^h(x)=\sum_{i=0}^n a_ib_i $$     (7.6) as well as investigate how the accuracy of our approximation changes with n going from 2 to 4 and then 6.
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }

Case:n=2
First let's expand Eq.3.6 out to n=2 terms.
 * {| style="width:100%" border="0"

$$  \displaystyle u^h(x)=a_0b_0+a_1b_1+a_2b_2 $$     (7.7) Now consider Eq.7.4, and substitute the appropriate terms into Eq.7.7.
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle u^h(x)=a_0(1)+a_1(x)+a_2(x)^2 $$     (7.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\quad (x)^2\right ]\begin{bmatrix} a_0\\a_1\\a_2\end{bmatrix} $$     (7.9) In order for us to solve for the unknown $$a_i's$$ in Eq.7.9, we must have 3 linearly independent equations describing linear combinations of the $$a_i's.$$Two of the equations are easily obtained directly from the given boundary conditions in Eq.7.2 and Eq.7.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.7.5 and Eq.7.8 at the boundaries.
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle \begin{align} u^h(x=1)=a_0(1)+a_1(1)+a_2(1)^2&=0\\ a_0(1)+a_1(1)+a_2(1)^2&=0 \end{align} $$     (7.10)
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle a_0+a_1+a_2=0 $$     (7.11)
 * style="width:92%; padding:10px; border:2px solid #8888aa" |
 * style="width:92%; padding:10px; border:2px solid #8888aa" |
 * 
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle \frac{du}{dx}(x=0)=a_1+a_22(0)=-4 $$     (7.12)
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }


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

$$  \displaystyle a_1=-4 $$     (7.13) Now we just need one more linearly independent equation and we can then readily solve for the $$a_i's.$$ To develop another set of equations which are linearly independent of Eq.7.11 and Eq.7.13, we take the inner product between our approximation of u(x), Eq.7.9 and our basis set of functions Eq.7.4. Before getting to the inner product first, let's define our linear differential operator as the following
 * style="width:92%; padding:10px; border:2px solid #8888aa" |
 * style="width:92%; padding:10px; border:2px solid #8888aa" |
 * 
 * }
 * {| 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.7.14, we can now operate on our approximation in Eq.7.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\quad (x)^2\right ]\begin{bmatrix} a_0\\a_1\\a_2\end{bmatrix}+\frac{3}{2}&=0\\ \left[0\quad 0\quad 2\right ]\begin{bmatrix} a_0\\a_1\\a_2\end{bmatrix}+\frac{3}{2}&=0 \end{align} $$     (7.15) Which we can then rewrite Eq.7.15 as
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle \left[0\quad 0\quad 2\right ]\begin{bmatrix} a_0\\a_1\\a_2\end{bmatrix}=-\frac{3}{2} $$     (7.16) Therefor
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }
 * {| style="width:100%" border="0"

$$2a_2=-\frac{3}{2}$$ (7.21) Using Eq.7.11 and Eq.7.13, we can form the following matrix equation.
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle \begin{bmatrix} 1&1&1\\0&1&0\\0&0&2\end{bmatrix}\begin{bmatrix} a_0\\a_1\\a_2\end{bmatrix}=\begin{bmatrix}0\\-4\\-3/2\end{bmatrix} $$     (7.21) Let's solve for the inverse of the matrix in Eq.7.21 using the Gauss-Jordan Method. Letting the matrix above in Eq.7.21 equal $$\mathbf{K}$$, we can find $$\mathbf{K^{-1}}$$ by
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle \begin{align} \mathbf{K}\cdot\mathbf{I}&=\begin{bmatrix} 1&1&1&1&0&0\\0&1&0&0&1&0\\0&0&2&0&0&1\end{bmatrix}\\ &=\begin{bmatrix} 1&0&0&1&-1&-1/2\\0&1&0&0&1&0\\0&0&2&0&0&1\end{bmatrix}\\ &=\begin{bmatrix} 1&0&0&1&-1&-1/2\\0&1&0&0&1&0\\0&0&1&0&0&1/2\end{bmatrix}\\ \end{align} $$     (7.22)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle \therefore \mathbf{K^{-1}}=\begin{bmatrix}1&-1&-1/2\\0&1&0\\0&0&1/2\end{bmatrix} $$     (7.23) Now using Eq.7.23, we can solve Eq.7.21 for our unknown $$a_i's.$$
 * 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 \mathbf{K^{-1}}\cdot \mathbf{K}\begin{bmatrix} a_0\\a_1\\a_2\end{bmatrix}=\mathbf{K^{-1}}\begin{bmatrix}0\\-4\\-3/2\end{bmatrix} $$     (7.24)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle \begin{bmatrix} a_0\\a_1\\a_2\end{bmatrix} = \begin{bmatrix}1&-1&-1/2\\0&1&0\\0&0&1/2\end{bmatrix}\begin{bmatrix}0\\-4\\-3/2\end{bmatrix} $$     (7.25)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle \begin{bmatrix} a_0\\a_1\\a_2\end{bmatrix}=\begin{bmatrix}19/4\\-4\\-3/4\end{bmatrix} $$     (7.26)
 * style="width:92%; padding:10px; border:2px solid #8888aa" |
 * style="width:92%; padding:10px; border:2px solid #8888aa" |
 * <p style="text-align:right">
 * }

Solution

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

$$  \displaystyle \therefore u^h(x)=\frac{19}{4}-4(x)-\frac{3}{4}(x)^2 $$     (7.27) 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 $$u^h(x)$$, 7.27, to $$u(x)$$, 7.5, we can see that using this basis gives an exact solution to $$u(x)$$
 * 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 u^h(x)= \frac{19}{4}-4(x)-\frac{3}{4}(x)^2 $$     (7.27)
 * style="width:92%; padding:10px; |
 * style="width:92%; padding:10px; |
 * <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">
 * }

Case:n=4
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) Using our predefined linear differential operator in Eq.7.14.
 * 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 \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">
 * }


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

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

Solution

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

$$  \displaystyle \therefore u^h(x)=\frac{19}{4}-4(x)-\frac{3}{4}(x)^2 $$     (7.46) 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)$$
 * style="width:92%; padding:10px; border:2px solid #8888aa" |
 * style="width:92%; padding:10px; border:2px solid #8888aa" |
 * <p style="text-align:right">
 * }

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

Case:n=6

 * {| 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) 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 $$     (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) 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:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| 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">
 * }

Solution

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

$$  \displaystyle \therefore u^h(x)=\frac{19}{4}-4(x)-\frac{3}{4}(x)^2 $$     (7.58) 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.
 * style="width:92%; padding:10px; border:2px solid #8888aa" |
 * style="width:92%; padding:10px; border:2px solid #8888aa" |
 * <p style="text-align:right">
 * }