d
d
x
(
A
E
d
u
d
x
)
+
2
x
=
0
{\displaystyle {\frac {d}{dx}}\left({AE{\frac {du}{dx}}}\right)+2x=0}
on
1
<
x
<
3
{\displaystyle 1<x<3}
(10.1)
σ
(
1
)
=
(
E
d
u
d
x
)
x
=
1
=
0.1
{\displaystyle \sigma (1)={\left({E{\frac {du}{dx}}}\right)_{x=1}}=0.1}
(10.2)
u
(
3
)
=
0.001
{\displaystyle u(3)=0.001}
(10.3)
where the weak form is
A trial solution for u(x) is suggested as
u
(
x
)
=
α
0
+
α
1
(
x
−
3
)
+
α
2
(
x
−
3
)
2
{\displaystyle u(x)={\alpha _{0}}+{\alpha _{1}}(x-3)+{\alpha _{2}}{(x-3)^{2}}}
(10.5)
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
From the given information the equations for u(x) and w(x) are as follows
u
(
x
)
=
α
0
+
α
1
(
x
−
3
)
+
α
2
(
x
−
3
)
2
{\displaystyle u(x)={\alpha _{0}}+{\alpha _{1}}(x-3)+{\alpha _{2}}{(x-3)^{2}}}
(10.5)
w
(
x
)
=
β
0
+
β
1
(
x
−
3
)
+
β
2
(
x
−
3
)
2
{\displaystyle w(x)={\beta _{0}}+{\beta _{1}}(x-3)+{\beta _{2}}{(x-3)^{2}}}
(10.6)
Using the initial condition
w
(
3
)
=
0
{\displaystyle w(3)=0}
w
(
3
)
=
β
0
+
β
1
(
3
−
3
)
+
β
2
(
3
−
3
)
2
⇒
w
(
3
)
=
0
=
β
0
{\displaystyle w(3)={\beta _{0}}+{\beta _{1}}(3-3)+{\beta _{2}}{(3-3)^{2}}\Rightarrow w(3)=0={\beta _{0}}}
(10.7)
Using the condition that
u
(
3
)
=
0.001
{\displaystyle u(3)=0.001}
w
(
3
)
=
α
0
+
α
1
(
3
−
3
)
+
α
2
(
3
−
3
)
2
⇒
u
(
3
)
=
0.001
=
α
0
{\displaystyle w(3)={\alpha _{0}}+{\alpha _{1}}(3-3)+{\alpha _{2}}{(3-3)^{2}}\Rightarrow u(3)=0.001={\alpha _{0}}}
(10.8)
The partial derivatives of u(x) and w(x) are
d
u
(
x
)
d
x
=
α
1
+
2
α
2
(
x
−
3
)
{\displaystyle {\frac {du(x)}{dx}}={\alpha _{1}}+2{\alpha _{2}}(x-3)}
(10.8)
d
w
(
x
)
d
x
=
β
1
+
2
β
2
(
x
−
3
)
{\displaystyle {\frac {dw(x)}{dx}}={\beta _{1}}+2{\beta _{2}}(x-3)}
(10.9)
Replacing, the weak form becomes
A
E
∫
1
3
[
β
1
+
2
β
2
(
x
−
3
)
]
[
α
1
+
2
α
2
(
x
−
3
)
]
d
x
=
−
0.1
(
β
1
−
4
β
2
)
A
+
∫
1
3
2
x
[
β
1
+
2
β
2
(
x
−
3
)
]
d
x
{\displaystyle AE\int \limits _{1}^{3}{\left[{{\beta _{1}}+2{\beta _{2}}(x-3)}\right]}\left[{{\alpha _{1}}+2{\alpha _{2}}(x-3)}\right]dx=-0.1({\beta _{1}}-4{\beta _{2}})A+\int \limits _{1}^{3}{2x\left[{{\beta _{1}}+2{\beta _{2}}(x-3)}\right]}dx}
(10.10)
After integration the equation becomes
A
E
[
β
1
(
2
α
1
−
4
α
2
)
+
β
2
(
−
4
α
1
+
10
3
α
2
)
]
=
−
0.1
(
β
1
−
4
β
2
)
A
+
8
β
1
−
62
3
β
2
{\displaystyle AE[{\beta _{1}}(2{\alpha _{1}}-4{\alpha _{2}})+{\beta _{2}}(-4{\alpha _{1}}+{\frac {10}{3}}{\alpha _{2}})]=-0.1({\beta _{1}}-4{\beta _{2}})A+8{\beta _{1}}-{\frac {62}{3}}{\beta _{2}}}
(10.11)
Rearranging we get
β
1
[
A
E
(
2
α
1
−
4
α
2
)
+
0.1
A
−
8
]
+
β
2
[
A
E
(
−
4
α
1
+
10
3
α
2
)
−
.4
A
+
62
3
]
=
0
{\displaystyle {\beta _{1}}\left[{AE(2{\alpha _{1}}-4{\alpha _{2}})+0.1A-8}\right]+{\beta _{2}}\left[{AE(-4{\alpha _{1}}+{\frac {10}{3}}{\alpha _{2}})-.4A+{\frac {62}{3}}}\right]=0}
(10.12)
The
β
0
{\displaystyle \beta _{0}}
and
β
1
{\displaystyle \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
A
E
[
2
−
4
−
4
10
3
]
[
α
1
α
2
]
=
[
0.1
A
−
8
.4
A
−
20.666
]
{\displaystyle AE\left[{\begin{array}{*{20}{c}}2&{-4}\\{-4}&{\frac {10}{3}}\end{array}}\right]\left[{\begin{array}{*{20}{c}}{\alpha _{1}}\\{\alpha _{2}}\end{array}}\right]=\left[{\begin{array}{*{20}{c}}{0.1A-8}\\{.4A-20.666}\end{array}}\right]}
(10.13)
The solution to the weak form becomes
[
α
1
α
2
]
=
[
2
−
4
−
4
10
3
]
−
1
[
0.1
A
−
8
0.4
A
−
20.666
]
(
A
E
)
−
1
{\displaystyle \left[{\begin{array}{*{20}{c}}{\alpha _{1}}\\{\alpha _{2}}\end{array}}\right]={\left[{\begin{array}{*{20}{c}}2&{-4}\\{-4}&{\frac {10}{3}}\end{array}}\right]^{-1}}\left[{\begin{array}{*{20}{c}}{0.1A-8}\\{0.4A-20.666}\end{array}}\right]{(AE)^{-1}}}
(10.14)
Giving the solution of
[
α
1
α
2
]
=
[
−
.2071
+
11.7132
a
−
0
.1286
+
7
.8566
a
]
E
−
1
{\displaystyle \left[{\begin{array}{*{20}{c}}{\alpha _{1}}\\{\alpha _{2}}\end{array}}\right]=\left[{\begin{array}{*{20}{c}}{-.2071+{\frac {11.7132}{a}}}\\{-{\rm {0}}{\rm {.1286}}+{\frac {{\rm {7}}{\rm {.8566}}}{a}}}\end{array}}\right]{E^{-1}}}
(10.15)
Problem 3.7: Rework Problem 3.1 without using a shift in the given polynomial basis.
edit
2
d
2
u
d
x
2
+
3
=
0
{\displaystyle \displaystyle 2{\frac {d^{2}u}{dx^{2}}}+3=0}
(7.1)
Boundary Conditions:
u
(
x
=
1
)
=
0
{\displaystyle \displaystyle u(x=1)=0}
(7.2)
−
d
u
d
x
(
x
=
0
)
=
4
{\displaystyle \displaystyle -{\frac {du}{dx}}(x=0)=4}
(7.3)
b
j
=
(
x
)
j
{\displaystyle \displaystyle b_{j}=(x)^{j}}
(7.4)
The exact solution to Eq.3.1:
u
(
x
)
=
−
3
4
x
2
−
4
x
+
19
4
{\displaystyle \displaystyle u(x)=-{\frac {3}{4}}x^{2}-4x+{\frac {19}{4}}}
(7.5)
We want to find an approximation to Eq.3.5 in the form of
u
h
(
x
)
=
∑
i
=
0
n
a
i
b
i
{\displaystyle \displaystyle u^{h}(x)=\sum _{i=0}^{n}a_{i}b_{i}}
(7.6)
as well as investigate how the accuracy of our approximation changes with n going from 2 to 4 and then 6.
First let's expand Eq.3.6 out to n=2 terms.
u
h
(
x
)
=
a
0
b
0
+
a
1
b
1
+
a
2
b
2
{\displaystyle \displaystyle u^{h}(x)=a_{0}b_{0}+a_{1}b_{1}+a_{2}b_{2}}
(7.7)
Now consider Eq.7.4, and substitute the appropriate terms into Eq.7.7.
u
h
(
x
)
=
a
0
(
1
)
+
a
1
(
x
)
+
a
2
(
x
)
2
{\displaystyle \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.
u
h
(
x
)
=
[
1
x
(
x
)
2
]
[
a
0
a
1
a
2
]
{\displaystyle \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
{\displaystyle a_{i}'s}
in Eq.7.9, we must have 3 linearly independent equations
describing linear combinations of the
a
i
′
s
.
{\displaystyle 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.
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
{\displaystyle \displaystyle {\begin{aligned}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{aligned}}}
(7.10)
a
0
+
a
1
+
a
2
=
0
{\displaystyle \displaystyle a_{0}+a_{1}+a_{2}=0}
(7.11)
d
u
d
x
(
x
=
0
)
=
a
1
+
a
2
2
(
0
)
=
−
4
{\displaystyle \displaystyle {\frac {du}{dx}}(x=0)=a_{1}+a_{2}2(0)=-4}
(7.12)
a
1
=
−
4
{\displaystyle \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
.
{\displaystyle 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
P
(
⋅
)
=
d
2
d
x
2
+
3
2
=
0
{\displaystyle \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.
P
(
u
h
)
=
d
2
d
x
2
[
1
x
(
x
)
2
]
[
a
0
a
1
a
2
]
+
3
2
=
0
[
0
0
2
]
[
a
0
a
1
a
2
]
+
3
2
=
0
{\displaystyle \displaystyle {\begin{aligned}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{aligned}}}
(7.15)
Which we can then rewrite Eq.7.15 as
[
0
0
2
]
[
a
0
a
1
a
2
]
=
−
3
2
{\displaystyle \displaystyle \left[0\quad 0\quad 2\right]{\begin{bmatrix}a_{0}\\a_{1}\\a_{2}\end{bmatrix}}=-{\frac {3}{2}}}
(7.16)
Therefor
2
a
2
=
−
3
2
{\displaystyle 2a_{2}=-{\frac {3}{2}}}
(7.21)
Using Eq.7.11 and Eq.7.13, we can form the following matrix equation.
[
1
1
1
0
1
0
0
0
2
]
[
a
0
a
1
a
2
]
=
[
0
−
4
−
3
/
2
]
{\displaystyle \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
K
{\displaystyle \mathbf {K} }
, we can find
K
−
1
{\displaystyle \mathbf {K^{-1}} }
by
K
⋅
I
=
[
1
1
1
1
0
0
0
1
0
0
1
0
0
0
2
0
0
1
]
=
[
1
0
0
1
−
1
−
1
/
2
0
1
0
0
1
0
0
0
2
0
0
1
]
=
[
1
0
0
1
−
1
−
1
/
2
0
1
0
0
1
0
0
0
1
0
0
1
/
2
]
{\displaystyle \displaystyle {\begin{aligned}\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{aligned}}}
(7.22)
∴
K
−
1
=
[
1
−
1
−
1
/
2
0
1
0
0
0
1
/
2
]
{\displaystyle \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
.
{\displaystyle a_{i}'s.}
K
−
1
⋅
K
[
a
0
a
1
a
2
]
=
K
−
1
[
0
−
4
−
3
/
2
]
{\displaystyle \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)
[
a
0
a
1
a
2
]
=
[
1
−
1
−
1
/
2
0
1
0
0
0
1
/
2
]
[
0
−
4
−
3
/
2
]
{\displaystyle \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)
[
a
0
a
1
a
2
]
=
[
19
/
4
−
4
−
3
/
4
]
{\displaystyle \displaystyle {\begin{bmatrix}a_{0}\\a_{1}\\a_{2}\end{bmatrix}}={\begin{bmatrix}19/4\\-4\\-3/4\end{bmatrix}}}
(7.26)
∴
u
h
(
x
)
=
19
4
−
4
(
x
)
−
3
4
(
x
)
2
{\displaystyle \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
)
{\displaystyle u^{h}(x)}
, 7.27, to
u
(
x
)
{\displaystyle u(x)}
, 7.5, we can see that using this basis gives an exact solution to
u
(
x
)
{\displaystyle u(x)}
u
h
(
x
)
=
19
4
−
4
(
x
)
−
3
4
(
x
)
2
{\displaystyle \displaystyle u^{h}(x)={\frac {19}{4}}-4(x)-{\frac {3}{4}}(x)^{2}}
(7.27)
u
(
x
)
=
19
4
−
4
(
x
)
−
3
4
(
x
)
2
{\displaystyle \displaystyle u(x)={\frac {19}{4}}-4(x)-{\frac {3}{4}}(x)^{2}}
(7.5)
Graphical Comparison Between Exact and Numerical Approximate Solutions
edit
We will follow exactly the same methodology as we have above, leaving out the explanations for each step.
u
h
(
x
)
=
a
0
b
0
+
a
1
b
1
+
a
2
b
2
+
a
3
b
3
+
a
4
b
4
{\displaystyle \displaystyle u^{h}(x)=a_{0}b_{0}+a_{1}b_{1}+a_{2}b_{2}+a_{3}b_{3}+a_{4}b_{4}}
(7.32)
u
h
(
x
)
=
a
0
(
1
)
+
a
1
(
x
)
+
a
2
(
x
)
2
+
a
3
(
x
)
3
+
a
4
(
x
)
4
{\displaystyle \displaystyle u^{h}(x)=a_{0}(1)+a_{1}(x)+a_{2}(x)^{2}+a_{3}(x)^{3}+a_{4}(x)^{4}}
(7.33)
u
h
(
x
)
=
[
1
x
x
2
x
3
x
4
]
[
a
0
a
1
a
2
a
3
a
4
]
{\displaystyle \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.
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
{\displaystyle \displaystyle {\begin{aligned}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{aligned}}}
(7.35)
a
0
+
a
1
+
a
2
+
a
3
+
a
4
=
0
{\displaystyle \displaystyle a_{0}+a_{1}+a_{2}+a_{3}+a_{4}=0}
(7.36)
d
u
h
d
x
(
x
=
0
)
=
0
+
a
1
+
0
+
0
+
0
{\displaystyle \displaystyle {\frac {du^{h}}{dx}}(x=0)=0+a_{1}+0+0+0}
(7.37)
a
1
=
−
4
{\displaystyle \displaystyle a_{1}=-4}
(7.38)
Using our predefined linear differential operator in Eq.7.14.
P
(
u
h
)
=
d
2
d
x
2
[
1
x
x
2
x
3
x
4
]
[
a
0
a
1
a
2
a
3
a
4
]
+
3
2
{\displaystyle \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
,
{\displaystyle a_{i}'s,}
we will have to choose 3 equations from our inner product
operation.
⟨
b
i
,
P
(
u
h
)
⟩
=
∫
0
1
b
i
P
(
u
h
)
=
0
{\displaystyle \displaystyle \left\langle b_{i},P(u^{h})\right\rangle =\int _{0}^{1}b_{i}P(u^{h})=0}
(7.40)
∫
0
1
[
1
x
x
2
x
3
x
4
]
[
0
0
2
6
(
x
)
12
(
x
)
2
]
d
x
[
a
0
a
1
a
2
a
3
a
4
]
=
−
3
2
∫
0
1
[
1
x
x
2
x
3
x
4
]
d
x
{\displaystyle \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)
∫
0
1
[
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
]
d
x
[
a
0
a
1
a
2
a
3
a
4
]
=
−
3
2
∫
0
1
[
1
x
x
2
x
3
x
4
]
d
x
{\displaystyle \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)
[
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
]
[
a
0
a
1
a
2
a
3
a
4
]
=
−
[
3
/
2
3
/
4
3
/
6
3
/
8
3
/
10
]
{\displaystyle \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
[
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
]
[
a
0
a
1
a
2
a
3
a
4
]
=
−
[
0
4
3
/
6
3
/
8
3
/
10
]
{\displaystyle \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)
Solving this system using MATLAB, the solution becomes
[
a
0
a
1
a
2
a
3
a
4
]
=
[
19
/
4
−
4
−
3
/
4
0
0
]
{\displaystyle \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)
∴
u
h
(
x
)
=
19
4
−
4
(
x
)
−
3
4
(
x
)
2
{\displaystyle \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
)
{\displaystyle u(x)}
Graphical Comparison Between Exact and Numerical Approximate Solutions
edit
Egm5526.s11.team-2.langpm 14:38, 14 February 2011 (UTC)
u
h
(
x
)
=
a
0
b
0
+
a
1
b
1
+
a
2
b
2
+
a
3
b
3
+
a
4
b
4
+
a
5
b
5
+
a
6
b
6
=
a
0
+
a
1
x
+
a
2
x
2
+
a
3
x
3
+
a
4
x
4
+
a
5
x
5
+
a
6
x
6
{\displaystyle \displaystyle {\begin{aligned}u^{h}(x)&=a_{0}b_{0}+a_{1}b_{1}+a_{2}b_{2}+a_{3}b_{3}+a_{4}b_{4}+a_{5}b_{5}+a_{6}b_{6}\\&=a_{0}+a_{1}x+a_{2}x^{2}+a_{3}x^{3}+a_{4}x^{4}+a_{5}x^{5}+a_{6}x^{6}\end{aligned}}}
(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.
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
{\displaystyle \displaystyle {\begin{aligned}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{aligned}}}
(7.48)
a
0
+
a
1
+
a
2
+
a
3
+
a
4
+
a
5
+
a
6
=
0
{\displaystyle \displaystyle a_{0}+a_{1}+a_{2}+a_{3}+a_{4}+a_{5}+a_{6}=0}
(7.49)
d
u
h
d
x
(
x
=
0
)
=
0
+
a
1
+
0
+
0
+
0
+
0
+
0
{\displaystyle \displaystyle {\frac {du^{h}}{dx}}(x=0)=0+a_{1}+0+0+0+0+0}
(7.50)
a
1
=
−
4
{\displaystyle \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.
P
(
u
h
)
=
d
2
d
x
2
[
1
x
x
2
x
3
x
4
x
5
x
6
]
[
a
0
a
1
a
2
a
3
a
4
a
5
a
6
]
+
3
2
{\displaystyle \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.
⟨
b
i
,
P
(
u
h
)
⟩
=
∫
0
1
b
i
P
(
u
h
)
d
x
=
0
{\displaystyle \displaystyle \left\langle b_{i},P(u^{h})\right\rangle =\int _{0}^{1}b_{i}P(u^{h})\,dx=0}
(7.53)
∫
0
1
[
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
]
d
x
[
a
0
a
1
a
2
a
3
a
4
a
5
a
6
]
=
−
3
2
∫
0
1
[
1
x
(
x
)
2
(
x
)
3
(
x
)
4
(
x
)
5
(
x
)
6
]
{\displaystyle \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)
[
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
]
[
a
0
a
1
a
2
a
3
a
4
a
5
a
6
]
=
[
−
3
/
2
−
3
/
4
−
3
/
6
−
3
/
8
−
3
/
10
−
3
/
12
−
3
/
14
]
{\displaystyle \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.
[
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
]
[
a
0
a
1
a
2
a
3
a
4
a
5
a
6
]
=
[
0
−
4
−
3
/
6
−
3
/
8
−
3
/
10
−
3
/
12
−
3
/
14
]
{\displaystyle \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
{\displaystyle n=4}
case, we use a MATLAB to determine the unknown
a
i
′
s
{\displaystyle a_{i}'s}
adn to determine the final form of our approximation to the solution of the differential equation 7.1.
[
a
0
a
1
a
2
a
3
a
4
a
5
a
6
]
=
[
19
/
4
−
4
−
3
/
4
0
0
0
0
]
{\displaystyle \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)
∴
u
h
(
x
)
=
19
4
−
4
(
x
)
−
3
4
(
x
)
2
{\displaystyle \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.
Graphical Comparison Between the Exact and Numerical Solutions
edit