v
[
y
]
=
∫
0
1
(
1
2
(
y
′
2
+
y
)
)
d
x
取
极
值
v[y]=\int_{0}^{1}\left(\frac{1}{2}( y^{\prime 2}+y)\right) d x \quad 取极值
v[y]=∫01(21(y′2+y))dx取极值
y
(
0
)
=
0
,
y
(
1
)
=
1
y(0)=0, y(1)=1
y(0)=0,y(1)=1
第一步:区域剖分
将 自变量x的取值区域[0,1],以步长h,剖分为n份,等分点
x
0
=
0
,
x
1
,
x
2
,
.
.
.
,
x
n
=
1
x_0=0,x_1,x_2,...,x_n=1
x0=0,x1,x2,...,xn=1,其中
x
i
−
x
1
−
1
=
h
=
1
n
x_{i}-x_{1-1}=h=\frac{1}{n}
xi−x1−1=h=n1, 如下图所示,令n=4, 则
h
=
1
4
h=\frac{1}{4}
h=41。
其中,
y
0
=
y
(
x
0
)
=
0
,
y
4
=
y
(
x
4
)
=
1
y_0=y(x_0)=0, y_4=y(x_4)=1
y0=y(x0)=0,y4=y(x4)=1,
y
1
,
y
2
,
y
3
y_1,y_2,y_3
y1,y2,y3为待求的未知量。
第二步,选择插值函数(插值函数有很多种定义方式,具体参见数值分析等相关教材)
插值函数及其导数:
y
i
(
x
)
=
y
i
−
y
i
−
1
h
(
x
−
x
i
−
1
)
+
y
i
−
1
y_{i}(x)=\frac{y_{i}-y_{i-1}}{h}\left(x-x_{i-1}\right)+y_{i-1}
yi(x)=hyi−yi−1(x−xi−1)+yi−1
y
i
′
(
x
)
=
y
i
−
y
i
−
1
h
y_{i}^{\prime}(x)=\frac{y_{i}-y_{i-1}}{h}
yi′(x)=hyi−yi−1
第三步,单元分析
将整个的积分
v
[
y
]
=
∫
0
1
(
1
2
y
′
2
+
y
)
d
x
v[y]=\int_{0}^{1}\left(\frac{1}{2} y^{\prime 2}+y\right) d x \quad
v[y]=∫01(21y′2+y)dx 分解为各个单元的积分
v
i
(
y
)
=
∫
x
i
−
1
x
i
1
2
(
y
′
2
+
y
)
d
x
=
∫
x
i
−
1
x
i
1
2
{
[
y
i
′
(
x
)
]
2
+
y
i
(
x
)
}
d
x
v_{i}(y)=\int_{x_{i-1}}^{x_i} \frac{1}{2}\left(y^{\prime2}+y\right) d x=\int_{x_{i-1}}^{x_i} \frac{1}{2}\left\{\left[y_{i}{\prime}(x)\right]^{2}+y_{i}(x)\right\} d x
vi(y)=∫xi−1xi21(y′2+y)dx=∫xi−1xi21{[yi′(x)]2+yi(x)}dx
将插值函数代入,并求积分可得:
v
i
(
y
)
=
1
2
h
(
y
i
−
y
i
−
1
)
2
+
h
2
(
y
i
+
y
i
−
1
)
v_{i}(y)=\frac{1}{2 h}\left(y_{i}-y_{i-1}\right)^{2}+\frac{h}{2}\left(y_{i}+y_{i-1}\right)
vi(y)=2h1(yi−yi−1)2+2h(yi+yi−1)
将此表示为
v
i
(
y
)
=
v
i
(
y
i
,
y
i
−
1
)
v_{i}(y)=v_{i}\left(y_{i}, y_{i-1}\right)
vi(y)=vi(yi,yi−1)
具体的4个单元积分为:
v
1
(
y
)
=
1
2
h
(
y
1
−
y
0
)
2
+
h
2
(
y
1
+
y
0
)
v_{1}(y)=\frac{1}{2 h}\left(y_{1}-y_{0}\right)^{2}+\frac{h}{2}\left(y_{1}+y_{0}\right)
v1(y)=2h1(y1−y0)2+2h(y1+y0)
v
2
(
y
)
=
1
2
h
(
y
2
−
y
1
)
2
+
h
2
(
y
2
+
y
1
)
v_{2}(y)=\frac{1}{2 h}\left(y_{2}-y_{1}\right)^{2}+\frac{h}{2}\left(y_{2}+y_{1}\right)
v2(y)=2h1(y2−y1)2+2h(y2+y1)
v
3
(
y
)
=
1
2
h
(
y
3
−
y
2
)
2
+
h
2
(
y
3
+
y
2
)
v_{3}(y)=\frac{1}{2 h}\left(y_{3}-y_{2}\right)^{2}+\frac{h}{2}\left(y_{3}+y_{2}\right)
v3(y)=2h1(y3−y2)2+2h(y3+y2)
v
4
(
y
)
=
1
2
h
(
y
4
−
y
3
)
2
+
h
2
(
y
4
+
y
3
)
v_{4}(y)=\frac{1}{2 h}\left(y_{4}-y_{3}\right)^{2}+\frac{h}{2}\left(y_{4}+y_{3}\right)
v4(y)=2h1(y4−y3)2+2h(y4+y3)
第四步:总体合成
将各个单元积分合并成为总体:
v
[
y
]
=
∫
0
1
(
1
2
y
′
2
+
y
)
d
x
=
∑
i
=
1
n
v
i
(
y
)
=
∑
i
=
1
n
v
i
(
y
i
,
y
i
−
1
)
v[y]=\int_{0}^{1}\left(\frac{1}{2} y^{\prime2}+y\right) d x=\sum_{i=1}^{n} v_{i}(y)=\sum_{i=1}^{n} v_{i}\left(y_{i}, y_{i-1}\right)
v[y]=∫01(21y′2+y)dx=i=1∑nvi(y)=i=1∑nvi(yi,yi−1)
第五步:求偏导,泛函
v
[
y
]
v[y]
v[y]取极值,相当于多元函数
v
(
y
1
,
y
2
,
.
.
.
,
y
n
−
1
)
v(y_1,y_2,...,y_{n-1})
v(y1,y2,...,yn−1)取极值。
∂
v
(
y
1
,
y
2
,
⋯
,
y
n
−
1
)
∂
y
i
=
0
(
i
=
1
,
2
,
⋯
,
n
−
1
)
\frac{\partial v\left(y_{1}, y_{2}, \cdots, y_{n-1}\right)}{\partial y_{i}}=0 \quad(i=1,2, \cdots, n-1)
∂yi∂v(y1,y2,⋯,yn−1)=0(i=1,2,⋯,n−1)
具体展开为:
∂
v
∂
y
1
=
∂
v
1
∂
y
1
+
∂
v
2
∂
y
1
=
4
(
0
+
2
y
1
−
y
2
)
+
1
4
=
0
\frac{\partial v}{\partial y_1}= \frac{\partial v_1}{\partial y_1} + \frac{\partial v_2}{\partial y_1} = 4\left(0+2 y_{1}-y_{2}\right)+\frac{1}{4}=0
∂y1∂v=∂y1∂v1+∂y1∂v2=4(0+2y1−y2)+41=0
∂
v
∂
y
2
=
∂
v
2
∂
y
2
+
∂
v
3
∂
y
2
=
4
(
−
y
1
+
2
y
2
−
y
3
)
+
1
4
=
0
\frac{\partial v}{\partial y_2}= \frac{\partial v_2}{\partial y_2} + \frac{\partial v_3}{\partial y_2} = 4\left(-y_{1}+2 y_{2}-y_{3}\right)+\frac{1}{4}=0
∂y2∂v=∂y2∂v2+∂y2∂v3=4(−y1+2y2−y3)+41=0
∂
v
∂
y
3
=
∂
v
3
∂
y
3
+
∂
v
4
∂
y
3
=
4
(
−
y
2
+
2
y
3
−
1
)
+
1
4
=
0
\frac{\partial v}{\partial y_3}= \frac{\partial v_3}{\partial y_3} + \frac{\partial v_4}{\partial y_3} = 4\left(-y_{2}+2 y_{3}-1\right)+\frac{1}{4}=0
∂y3∂v=∂y3∂v3+∂y3∂v4=4(−y2+2y3−1)+41=0
对上述方程组整理后,可得:
[
2
−
1
0
−
1
2
−
1
0
−
1
2
]
[
y
1
y
2
y
3
]
=
[
−
1
16
−
1
16
15
16
]
\left[\begin{array}{rrr}2 & -1 & 0 \\ -1 & 2 & -1 \\ 0 & -1 & 2\end{array}\right]\left[\begin{array}{l}y_{1} \\ y_{2} \\ y_{3}\end{array}\right]=\left[\begin{array}{r}-\frac{1}{16} \\ -\frac{1}{16} \\ \frac{15}{16}\end{array}\right]
⎣⎡2−10−12−10−12⎦⎤⎣⎡y1y2y3⎦⎤=⎣⎡−161−1611615⎦⎤
解线性方程组,得到最终结果为:
y
1
=
0.15625
,
y
2
=
0.375
,
y
3
=
0.65625
y_1=0.15625,y_2=0.375,y_3=0.65625
y1=0.15625,y2=0.375,y3=0.65625
摘自:地球物理中的有限元法–徐世浙