文章目录
经典变分法
推导1
推导步骤来自
理论力学3—变分法的核心,欧拉-拉格朗日方程
δ
J
=
δ
∫
a
b
f
(
y
,
y
′
)
d
x
=
∫
a
b
δ
f
(
y
,
y
′
)
d
x
=
∫
a
b
(
∂
f
∂
y
δ
y
+
∂
f
∂
y
′
δ
y
′
)
d
x
=
∫
a
b
∂
f
∂
y
δ
y
d
x
+
∫
a
b
∂
f
∂
y
′
d
d
x
δ
y
d
x
∫
a
b
∂
f
∂
y
′
d
d
x
δ
y
d
x
=
∫
a
b
∂
f
∂
y
′
d
δ
y
=
[
∂
f
∂
y
′
δ
y
]
a
b
−
∫
a
b
δ
y
d
d
x
∂
f
∂
y
′
d
x
δ
J
=
[
∂
f
∂
y
′
δ
y
]
a
b
+
∫
a
b
∂
f
∂
y
δ
y
d
x
−
∫
a
b
δ
y
d
d
x
∂
f
∂
y
′
d
x
=
∫
a
b
(
∂
f
∂
y
−
d
d
x
∂
f
∂
y
′
)
δ
y
d
x
\begin{aligned} \delta J&=\delta\int_a^bf(y,y’)\text{d}x \\ &=\int_a^b\delta f(y,y’)\text{d}x \\ &=\int_a^b\left(\frac{\partial f}{\partial y}\delta y +\frac{\partial f}{\partial y’}\delta y’\right)\text{d}x \\ &=\int_a^b\frac{\partial f}{\partial y}\delta y\text{d}x+\int_a^b\frac{\partial f}{\partial y’}\frac{\text{d}}{\text{d}x}\delta y\text{d}x \\ \int_a^b\frac{\partial f}{\partial y’}\frac{\text{d}}{\text{d}x}\delta y\text{d}x &=\int_a^b\frac{\partial f}{\partial y’}\text{d}\delta y =\left[\frac{\partial f}{\partial y’}\delta y\right]_a^b -\int_a^b\delta y\frac{\text{d}}{\text{d}x}\frac{\partial f}{\partial y’}\text{d}x \\ \delta J&=\left[\frac{\partial f}{\partial y’}\delta y\right]_a^b +\int_a^b\frac{\partial f}{\partial y}\delta y\text{d}x -\int_a^b\delta y\frac{\text{d}}{\text{d}x}\frac{\partial f}{\partial y’}\text{d}x \\ &=\int_a^b\left(\frac{\partial f}{\partial y} -\frac{\text{d}}{\text{d}x}\frac{\partial f}{\partial y’}\right)\delta y\text{d}x \end{aligned}
δ
J
∫
a
b
∂
y
′
∂
f
d
x
d
δy
d
x
δ
J
=
δ
∫
a
b
f
(
y
,
y
′
)
d
x
=
∫
a
b
δ
f
(
y
,
y
′
)
d
x
=
∫
a
b
(
∂
y
∂
f
δy
+
∂
y
′
∂
f
δ
y
′
)
d
x
=
∫
a
b
∂
y
∂
f
δy
d
x
+
∫
a
b
∂
y
′
∂
f
d
x
d
δy
d
x
=
∫
a
b
∂
y
′
∂
f
d
δy
=
[
∂
y
′
∂
f
δy
]
a
b
−
∫
a
b
δy
d
x
d
∂
y
′
∂
f
d
x
=
[
∂
y
′
∂
f
δy
]
a
b
+
∫
a
b
∂
y
∂
f
δy
d
x
−
∫
a
b
δy
d
x
d
∂
y
′
∂
f
d
x
=
∫
a
b
(
∂
y
∂
f
−
d
x
d
∂
y
′
∂
f
)
δy
d
x
即
∂
f
∂
y
−
d
d
x
∂
f
∂
y
′
=
0
\frac{\partial f}{\partial y} -\frac{\text{d}}{\text{d}x}\frac{\partial f}{\partial y’}=0
∂
y
∂
f
−
d
x
d
∂
y
′
∂
f
=
0
另
d
f
d
x
=
∂
f
∂
y
d
y
d
x
+
∂
f
∂
y
′
d
y
′
d
x
=
d
d
x
∂
f
∂
y
′
d
y
d
x
+
∂
f
∂
y
′
d
y
′
d
x
\begin{aligned} \frac{\text{d}f}{\text{d}x}&=\frac{\partial f}{\partial y}\frac{\text{d}y}{\text{d}x} +\frac{\partial f}{\partial y’}\frac{\text{d}y’}{\text{d}x} \\ &=\frac{\text{d}}{\text{d}x}\frac{\partial f}{\partial y’}\frac{\text{d}y}{\text{d}x} +\frac{\partial f}{\partial y’}\frac{\text{d}y’}{\text{d}x} \\ \end{aligned}
d
x
d
f
=
∂
y
∂
f
d
x
d
y
+
∂
y
′
∂
f
d
x
d
y
′
=
d
x
d
∂
y
′
∂
f
d
x
d
y
+
∂
y
′
∂
f
d
x
d
y
′
即
d
d
x
(
y
′
∂
f
∂
y
′
−
f
)
=
0
y
′
∂
f
∂
y
′
−
f
=
C
\frac{\text{d}}{\text{d}x}\left(y’\frac{\partial f}{\partial y’}-f\right)=0 \\ y’\frac{\partial f}{\partial y’}-f=C
d
x
d
(
y
′
∂
y
′
∂
f
−
f
)
=
0
y
′
∂
y
′
∂
f
−
f
=
C
推导2
推导步骤来自
两小时搞定变分法
设
y
0
(
x
)
y_0(x)
y
0
(
x
)
为最优函数,
y
(
x
)
y(x)
y
(
x
)
为其它的函数,令
y
(
x
)
−
y
0
(
x
)
=
ϵ
η
(
x
)
=
δ
y
(
x
)
y(x)-y_0(x)=\epsilon\eta(x)=\delta y(x)
y
(
x
)
−
y
0
(
x
)
=
ϵη
(
x
)
=
δy
(
x
)
,则
J
(
ϵ
)
=
∫
a
b
f
(
y
(
ϵ
)
,
y
′
(
ϵ
)
,
x
)
d
x
=
∫
a
b
f
(
y
0
+
ϵ
η
(
x
)
,
y
0
′
+
ϵ
η
′
(
x
)
,
x
)
d
x
d
J
d
ϵ
=
∫
a
b
(
∂
f
∂
y
d
y
d
ϵ
+
∂
f
∂
y
′
d
y
′
d
ϵ
+
∂
f
∂
x
d
x
d
ϵ
)
d
x
=
∫
a
b
(
∂
f
∂
y
η
+
∂
f
∂
y
′
η
′
)
d
x
=
∫
a
b
∂
f
∂
y
η
d
x
+
∫
a
b
∂
f
∂
y
′
d
η
=
∫
a
b
∂
f
∂
y
η
d
x
+
[
∂
f
∂
y
′
(
x
)
η
(
x
)
]
a
b
+
∫
a
b
η
(
x
)
d
d
x
∂
f
∂
y
′
d
x
=
∫
a
b
(
∂
f
∂
y
−
d
d
x
∂
f
∂
y
′
)
η
(
x
)
d
x
+
[
∂
f
∂
y
′
(
x
)
η
(
x
)
]
a
b
\begin{aligned} J(\epsilon)&=\int_a^bf(y(\epsilon),y'(\epsilon),x)\text{d}x \\ &=\int_a^bf(y_0+\epsilon\eta(x),y_0’+\epsilon\eta'(x),x)\text{d}x \\ \frac{\text{d}J}{\text{d}\epsilon} &=\int_a^b\left(\frac{\partial f}{\partial y}\frac{\text{d}y}{\text{d}\epsilon} +\frac{\partial f}{\partial y’}\frac{\text{d}y’}{\text{d}\epsilon} +\frac{\partial f}{\partial x}\frac{\text{d}x}{\text{d}\epsilon}\right)\text{d}x \\ &=\int_a^b\left(\frac{\partial f}{\partial y}\eta +\frac{\partial f}{\partial y’}\eta’\right)\text{d}x \\ &=\int_a^b\frac{\partial f}{\partial y}\eta\text{d}x+\int_a^b\frac{\partial f}{\partial y’}\text{d}\eta \\ &=\int_a^b\frac{\partial f}{\partial y}\eta\text{d}x +\left[\frac{\partial f}{\partial y'(x)}\eta(x)\right]_a^b +\int_a^b\eta(x)\frac{\text{d}}{\text{d}x}\frac{\partial f}{\partial y’}\text{d}x \\ &=\int_a^b\left(\frac{\partial f}{\partial y} -\frac{\text{d}}{\text{d}x}\frac{\partial f}{\partial y’}\right)\eta(x)\text{d}x +\left[\frac{\partial f}{\partial y'(x)}\eta(x)\right]_a^b \end{aligned}
J
(
ϵ
)
d
ϵ
d
J
=
∫
a
b
f
(
y
(
ϵ
)
,
y
′
(
ϵ
)
,
x
)
d
x
=
∫
a
b
f
(
y
0
+
ϵη
(
x
)
,
y
0
′
+
ϵ
η
′
(
x
)
,
x
)
d
x
=
∫
a
b
(
∂
y
∂
f
d
ϵ
d
y
+
∂
y
′
∂
f
d
ϵ
d
y
′
+
∂
x
∂
f
d
ϵ
d
x
)
d
x
=
∫
a
b
(
∂
y
∂
f
η
+
∂
y
′
∂
f
η
′
)
d
x
=
∫
a
b
∂
y
∂
f
η
d
x
+
∫
a
b
∂
y
′
∂
f
d
η
=
∫
a
b
∂
y
∂
f
η
d
x
+
[
∂
y
′
(
x
)
∂
f
η
(
x
)
]
a
b
+
∫
a
b
η
(
x
)
d
x
d
∂
y
′
∂
f
d
x
=
∫
a
b
(
∂
y
∂
f
−
d
x
d
∂
y
′
∂
f
)
η
(
x
)
d
x
+
[
∂
y
′
(
x
)
∂
f
η
(
x
)
]
a
b
终端时刻固定、终端状态自由
δ
J
=
∫
a
b
(
∂
f
∂
y
−
d
d
x
∂
f
∂
y
′
)
δ
y
d
x
+
∂
f
∂
y
′
(
b
)
δ
y
(
b
)
=
0
\begin{aligned} \delta J&=\int_a^b\left(\frac{\partial f}{\partial y} -\frac{\text{d}}{\text{d}x}\frac{\partial f}{\partial y’}\right)\delta y\text{d}x +\frac{\partial f}{\partial y'(b)}\delta y(b)=0 \end{aligned}
δ
J
=
∫
a
b
(
∂
y
∂
f
−
d
x
d
∂
y
′
∂
f
)
δy
d
x
+
∂
y
′
(
b
)
∂
f
δy
(
b
)
=
0
所以(等号两边都必须等于0的证明见下面的变分预备定理)
∫
a
b
(
∂
f
∂
y
−
d
d
x
∂
f
∂
y
′
)
δ
y
d
x
=
∂
f
∂
y
′
(
b
)
δ
y
(
b
)
=
0
\begin{aligned} \int_a^b\left(\frac{\partial f}{\partial y} -\frac{\text{d}}{\text{d}x}\frac{\partial f}{\partial y’}\right)\delta y\text{d}x =\frac{\partial f}{\partial y'(b)}\delta y(b)=0 \end{aligned}
∫
a
b
(
∂
y
∂
f
−
d
x
d
∂
y
′
∂
f
)
δy
d
x
=
∂
y
′
(
b
)
∂
f
δy
(
b
)
=
0
因为
δ
y
(
b
)
\delta y(b)
δy
(
b
)
不受限,所以
∂
f
∂
y
′
(
b
)
=
0
\frac{\partial f}{\partial y'(b)}=0
∂
y
′
(
b
)
∂
f
=
0
终端时刻自由、终端状态固定
终端时刻自由的一个公式
δ
y
(
b
+
d
b
)
=
δ
y
(
b
)
+
y
′
(
b
)
d
b
(
1
−
1
)
\delta y(b+\text{d}b)=\delta y(b)+y'(b)\text{d}b\quad(1-1)
δy
(
b
+
d
b
)
=
δy
(
b
)
+
y
′
(
b
)
d
b
(
1
−
1
)
δ
J
=
∫
a
b
+
d
b
f
(
y
+
δ
y
,
y
′
+
δ
y
′
)
d
x
−
∫
a
b
f
(
y
,
y
′
)
d
x
=
∫
a
b
δ
f
(
y
,
y
′
)
d
x
+
∫
b
d
b
f
(
y
+
δ
y
,
y
′
+
δ
y
′
)
d
x
=
∫
a
b
(
∂
f
∂
y
−
d
d
x
∂
f
∂
y
′
)
δ
y
d
x
+
∂
f
∂
y
′
(
b
)
δ
y
(
b
)
+
f
(
y
(
b
)
,
y
′
(
b
)
)
d
b
\begin{aligned} \delta J&=\int_a^{b+\text{d}b}f(y+\delta y,y’+\delta y’)\text{d}x -\int_a^{b}f(y,y’)\text{d}x \\ &=\int_a^b\delta f(y,y’)\text{d}x+\int_b^{\text{d}b}f(y+\delta y,y’+\delta y’)\text{d}x \\ &=\int_a^b\left(\frac{\partial f}{\partial y} -\frac{\text{d}}{\text{d}x}\frac{\partial f}{\partial y’}\right)\delta y\text{d}x +\frac{\partial f}{\partial y'(b)}\delta y(b)+f(y(b),y'(b))\text{d}b \\ \end{aligned}
δ
J
=
∫
a
b
+
d
b
f
(
y
+
δy
,
y
′
+
δ
y
′
)
d
x
−
∫
a
b
f
(
y
,
y
′
)
d
x
=
∫
a
b
δ
f
(
y
,
y
′
)
d
x
+
∫
b
d
b
f
(
y
+
δy
,
y
′
+
δ
y
′
)
d
x
=
∫
a
b
(
∂
y
∂
f
−
d
x
d
∂
y
′
∂
f
)
δy
d
x
+
∂
y
′
(
b
)
∂
f
δy
(
b
)
+
f
(
y
(
b
)
,
y
′
(
b
))
d
b
(补充说明:
∫
x
x
+
d
x
f
(
t
)
d
t
=
f
(
x
)
d
x
\int_x^{x+\text{d}x}f(t)\text{d}t=f(x)\text{d}x
∫
x
x
+
d
x
f
(
t
)
d
t
=
f
(
x
)
d
x
)
即
∂
f
∂
y
′
(
b
)
δ
y
(
b
)
+
f
(
y
(
b
)
,
y
′
(
b
)
)
d
b
=
0
(
1
−
2
)
\frac{\partial f}{\partial y'(b)}\delta y(b)+f(y(b),y'(b))\text{d}b=0\quad(1-2)
∂
y
′
(
b
)
∂
f
δy
(
b
)
+
f
(
y
(
b
)
,
y
′
(
b
))
d
b
=
0
(
1
−
2
)
又因为
δ
y
(
b
+
d
b
)
=
δ
y
(
b
)
+
y
′
(
b
)
d
b
=
0
\delta y(b+\text{d}b)=\delta y(b)+y'(b)\text{d}b=0
δy
(
b
+
d
b
)
=
δy
(
b
)
+
y
′
(
b
)
d
b
=
0
,所以
∂
f
∂
y
′
(
b
)
y
′
(
b
)
=
f
(
y
(
b
)
,
y
′
(
b
)
)
\frac{\partial f}{\partial y'(b)}y'(b)=f(y(b),y'(b))
∂
y
′
(
b
)
∂
f
y
′
(
b
)
=
f
(
y
(
b
)
,
y
′
(
b
))
终端时刻自由、终端状态自由
将式(1-1)代入(1-2)
∂
f
∂
y
′
(
b
)
(
δ
y
(
b
+
d
b
)
−
y
′
(
b
)
d
b
)
+
f
(
y
(
b
)
,
y
′
(
b
)
)
d
b
=
0
∂
f
∂
y
′
(
b
)
δ
y
(
b
+
d
b
)
+
(
f
(
y
(
b
)
,
y
′
(
b
)
)
−
∂
f
∂
y
′
(
b
)
)
d
b
=
0
\begin{aligned} & \frac{\partial f}{\partial y'(b)}(\delta y(b+\text{d}b)-y'(b)\text{d}b)+f(y(b),y'(b))\text{d}b=0 \\ & \frac{\partial f}{\partial y'(b)}\delta y(b+\text{d}b)+\left(f(y(b),y'(b)) -\frac{\partial f}{\partial y'(b)}\right)\text{d}b=0 \\ \end{aligned}
∂
y
′
(
b
)
∂
f
(
δy
(
b
+
d
b
)
−
y
′
(
b
)
d
b
)
+
f
(
y
(
b
)
,
y
′
(
b
))
d
b
=
0
∂
y
′
(
b
)
∂
f
δy
(
b
+
d
b
)
+
(
f
(
y
(
b
)
,
y
′
(
b
))
−
∂
y
′
(
b
)
∂
f
)
d
b
=
0
得到
∂
f
∂
y
′
(
b
)
=
f
(
y
(
b
)
,
y
′
(
b
)
)
=
0
\begin{aligned} & \frac{\partial f}{\partial y'(b)}=f(y(b),y'(b))=0 \\ \end{aligned}
∂
y
′
(
b
)
∂
f
=
f
(
y
(
b
)
,
y
′
(
b
))
=
0
终端时刻自由、终端状态约束
设约束方程
c
(
x
)
=
0
c(x)=0
c
(
x
)
=
0
,则约束时满足
δ
y
(
b
+
d
b
)
=
δ
y
(
b
)
+
y
′
(
b
)
d
b
=
c
′
(
b
)
d
b
\delta y(b+\text{d}b) =\delta y(b)+y'(b)\text{d}b=c'(b)\text{d}b
δy
(
b
+
d
b
)
=
δy
(
b
)
+
y
′
(
b
)
d
b
=
c
′
(
b
)
d
b
,代入式(1-2)得
∂
f
∂
y
′
(
b
)
(
c
′
(
b
)
−
y
′
(
b
)
)
d
b
+
f
(
y
(
b
)
,
y
′
(
b
)
)
d
b
=
0
[
∂
f
∂
y
′
(
c
′
−
y
′
)
+
f
(
y
,
y
′
)
]
x
=
b
=
0
\begin{aligned} & \frac{\partial f}{\partial y'(b)}(c'(b)-y'(b))\text{d}b+f(y(b),y'(b))\text{d}b=0 \\ & \left[\frac{\partial f}{\partial y’}(c’-y’)+f(y,y’)\right]_{x=b}=0 \\ \end{aligned}
∂
y
′
(
b
)
∂
f
(
c
′
(
b
)
−
y
′
(
b
))
d
b
+
f
(
y
(
b
)
,
y
′
(
b
))
d
b
=
0
[
∂
y
′
∂
f
(
c
′
−
y
′
)
+
f
(
y
,
y
′
)
]
x
=
b
=
0
极小值原理
下面的推导均可推广到
x
x
x
、
λ
\lambda
λ
等为向量形式。
哈密顿函数
设
H
(
x
,
u
,
λ
,
t
)
=
f
(
x
,
u
,
t
)
+
λ
(
t
)
g
(
x
,
u
,
t
)
H(x,u,\lambda,t)=f(x,u,t)+\lambda(t)g(x,u,t)
H
(
x
,
u
,
λ
,
t
)
=
f
(
x
,
u
,
t
)
+
λ
(
t
)
g
(
x
,
u
,
t
)
系统状态方程为
x
′
=
g
(
x
,
u
,
t
)
x’=g(x,u,t)
x
′
=
g
(
x
,
u
,
t
)
。定义泛函
J
=
∫
a
b
f
(
x
,
u
,
t
)
+
λ
(
t
)
(
g
(
x
,
u
,
t
)
−
x
′
(
t
)
)
d
t
=
∫
a
b
H
(
x
,
u
,
λ
,
t
)
d
t
−
∫
a
b
λ
(
t
)
d
x
(
t
)
=
∫
a
b
H
(
x
,
u
,
λ
,
t
)
d
t
+
∫
a
b
λ
′
(
t
)
x
(
t
)
d
t
−
[
λ
(
t
)
x
(
t
)
]
a
b
δ
J
=
∫
a
b
δ
H
(
x
,
u
,
λ
,
t
)
d
t
+
∫
a
b
λ
′
(
t
)
δ
x
(
t
)
d
t
−
λ
(
b
)
δ
x
(
b
)
=
∫
a
b
(
∂
H
∂
x
+
λ
′
)
δ
x
+
∂
H
∂
u
δ
u
d
t
−
λ
(
b
)
δ
x
(
b
)
\begin{aligned} J&=\int_a^bf(x,u,t)+\lambda(t)(g(x,u,t)-x'(t))\text{d}t \\ &=\int_a^bH(x,u,\lambda,t)\text{d}t-\int_a^b\lambda(t)\text{d}x(t) \\ &=\int_a^bH(x,u,\lambda,t)\text{d}t+\int_a^b\lambda'(t)x(t)\text{d}t-[\lambda(t)x(t)]_a^b \\ \delta J&=\int_a^b\delta H(x,u,\lambda,t)\text{d}t +\int_a^b\lambda'(t)\delta x(t)\text{d}t-\lambda(b)\delta x(b) \\ &=\int_a^b\left(\frac{\partial H}{\partial x}+\lambda’\right)\delta x +\frac{\partial H}{\partial u}\delta u\text{d}t -\lambda(b)\delta x(b) \\ \end{aligned}
J
δ
J
=
∫
a
b
f
(
x
,
u
,
t
)
+
λ
(
t
)
(
g
(
x
,
u
,
t
)
−
x
′
(
t
))
d
t
=
∫
a
b
H
(
x
,
u
,
λ
,
t
)
d
t
−
∫
a
b
λ
(
t
)
d
x
(
t
)
=
∫
a
b
H
(
x
,
u
,
λ
,
t
)
d
t
+
∫
a
b
λ
′
(
t
)
x
(
t
)
d
t
−
[
λ
(
t
)
x
(
t
)
]
a
b
=
∫
a
b
δH
(
x
,
u
,
λ
,
t
)
d
t
+
∫
a
b
λ
′
(
t
)
δ
x
(
t
)
d
t
−
λ
(
b
)
δ
x
(
b
)
=
∫
a
b
(
∂
x
∂
H
+
λ
′
)
δ
x
+
∂
u
∂
H
δ
u
d
t
−
λ
(
b
)
δ
x
(
b
)
由变分预备定理得到
∂
H
∂
λ
=
x
′
∂
H
∂
x
=
−
λ
′
∂
H
∂
u
=
0
\begin{aligned} & \frac{\partial H}{\partial \lambda}=x’ \\ & \frac{\partial H}{\partial x}=-\lambda’ \\ & \frac{\partial H}{\partial u}=0 \\ \end{aligned}
∂
λ
∂
H
=
x
′
∂
x
∂
H
=
−
λ
′
∂
u
∂
H
=
0
加入限制条件
下面开始最优控制,将积分上下限由
(
a
,
b
)
(a,b)
(
a
,
b
)
改为
(
t
0
,
t
f
)
(t_0,t_f)
(
t
0
,
t
f
)
。
末端时刻固定、末端状态约束时,加入末端性能指标
ϕ
(
x
f
)
\phi(x_f)
ϕ
(
x
f
)
极小和末端状态约束条件
ψ
(
x
f
)
=
0
\psi(x_f)=0
ψ
(
x
f
)
=
0
。
J
=
ϕ
(
x
)
+
γ
ψ
(
x
)
+
∫
t
0
t
f
f
(
x
,
u
,
t
)
+
λ
(
t
)
(
g
(
x
,
u
,
t
)
−
x
′
(
t
)
)
d
t
δ
J
=
(
∂
ϕ
∂
x
+
γ
∂
ψ
∂
x
−
λ
(
t
f
)
)
δ
x
(
t
f
)
+
∫
t
0
t
f
(
∂
H
∂
x
+
λ
′
)
δ
x
+
∂
H
∂
u
δ
u
d
t
\begin{aligned} J&=\phi(x)+\gamma\psi(x)+\int_{t_0}^{t_f}f(x,u,t)+\lambda(t)(g(x,u,t)-x'(t))\text{d}t \\ \delta J&=(\frac{\partial\phi}{\partial x} +\gamma\frac{\partial\psi}{\partial x}-\lambda(t_f))\delta x(t_f) +\int_{t_0}^{t_f}\left(\frac{\partial H}{\partial x}+\lambda’\right)\delta x +\frac{\partial H}{\partial u}\delta u\text{d}t \\ \end{aligned}
J
δ
J
=
ϕ
(
x
)
+
γ
ψ
(
x
)
+
∫
t
0
t
f
f
(
x
,
u
,
t
)
+
λ
(
t
)
(
g
(
x
,
u
,
t
)
−
x
′
(
t
))
d
t
=
(
∂
x
∂
ϕ
+
γ
∂
x
∂
ψ
−
λ
(
t
f
))
δ
x
(
t
f
)
+
∫
t
0
t
f
(
∂
x
∂
H
+
λ
′
)
δ
x
+
∂
u
∂
H
δ
u
d
t
横截条件
λ
(
t
f
)
=
∂
ϕ
∂
x
(
t
f
)
+
γ
∂
ψ
∂
x
(
t
f
)
\lambda(t_f)=\frac{\partial\phi}{\partial x(t_f)} +\gamma\frac{\partial\psi}{\partial x(t_f)}
λ
(
t
f
)
=
∂
x
(
t
f
)
∂
ϕ
+
γ
∂
x
(
t
f
)
∂
ψ
的矢量形式为
[
λ
1
(
t
f
)
λ
2
(
t
f
)
]
=
[
∂
ϕ
∂
x
1
(
t
f
)
∂
ϕ
∂
x
2
(
t
f
)
]
+
[
∂
ψ
1
∂
x
1
(
t
f
)
∂
ψ
2
∂
x
1
(
t
f
)
∂
ψ
1
∂
x
2
(
t
f
)
∂
ψ
2
∂
x
2
(
t
f
)
]
[
γ
1
γ
2
]
\left[\begin{matrix} \lambda_1(t_f) \\ \lambda_2(t_f) \end{matrix}\right] =\left[\begin{matrix} \displaystyle\frac{\partial\phi}{\partial x_1(t_f)} \\ \displaystyle\frac{\partial\phi}{\partial x_2(t_f)} \end{matrix}\right] +\left[\begin{matrix} \displaystyle\frac{\partial\psi_1}{\partial x_1(t_f)} & \displaystyle\frac{\partial\psi_2}{\partial x_1(t_f)} \\ \displaystyle\frac{\partial\psi_1}{\partial x_2(t_f)} & \displaystyle\frac{\partial\psi_2}{\partial x_2(t_f)} \end{matrix}\right] \left[\begin{matrix} \gamma_1 \\ \gamma_2 \end{matrix}\right]
[
λ
1
(
t
f
)
λ
2
(
t
f
)
]
=
∂
x
1
(
t
f
)
∂
ϕ
∂
x
2
(
t
f
)
∂
ϕ
+
∂
x
1
(
t
f
)
∂
ψ
1
∂
x
2
(
t
f
)
∂
ψ
1
∂
x
1
(
t
f
)
∂
ψ
2
∂
x
2
(
t
f
)
∂
ψ
2
[
γ
1
γ
2
]
如果末端状态自由则删除约束条件
ψ
(
x
f
)
=
0
\psi(x_f)=0
ψ
(
x
f
)
=
0
。如果末端状态固定,则删除横截条件
λ
(
t
f
)
\lambda(t_f)
λ
(
t
f
)
。
(因为末端状态固定时,
δ
x
(
t
f
)
\delta x(t_f)
δ
x
(
t
f
)
任意导致横截条件
λ
(
t
f
)
\lambda(t_f)
λ
(
t
f
)
不成立)
如果末端时刻自由,则增加哈密顿函数变化律公式
H
(
t
f
)
=
−
∂
ϕ
∂
t
f
−
γ
∂
ψ
∂
t
f
H(t_f)=-\frac{\partial\phi}{\partial t_f} -\gamma\frac{\partial\psi}{\partial t_f}
H
(
t
f
)
=
−
∂
t
f
∂
ϕ
−
γ
∂
t
f
∂
ψ
限制输入
几个前置证明
变分预备定理证明
-
证明1:若
h(
x
)
h(x)
h
(
x
)
为任意函数时均有
∫a
b
M
(
x
)
h
(
x
)
d
x
=
0
\int_a^bM(x)h(x)\text{d}x=0
∫
a
b
M
(
x
)
h
(
x
)
d
x
=
0
则
M(
x
)
≡
0
M(x)\equiv0
M
(
x
)
≡
0
。
反证法,若
M
(
x
)
≢
0
M(x)\not\equiv0
M
(
x
)
≡
0
,因为
h
(
x
)
h(x)
h
(
x
)
任意,令
h
(
x
)
=
−
M
(
x
)
(
x
−
a
)
(
x
−
b
)
h(x)=-M(x)(x-a)(x-b)
h
(
x
)
=
−
M
(
x
)
(
x
−
a
)
(
x
−
b
)
,则
M
(
x
)
h
(
x
)
=
−
M
2
(
x
)
(
x
−
a
)
(
x
−
b
)
M(x)h(x)=-M^2(x)(x-a)(x-b)
M
(
x
)
h
(
x
)
=
−
M
2
(
x
)
(
x
−
a
)
(
x
−
b
)
∵
x
∈
[
a
,
b
]
\because x\in[a,b]
∵
x
∈
[
a
,
b
]
,
∴
M
(
x
)
h
(
x
)
≥
0
\therefore M(x)h(x)\ge0
∴
M
(
x
)
h
(
x
)
≥
0
,且
∃
x
∈
(
a
,
b
)
\exist x\in(a,b)
∃
x
∈
(
a
,
b
)
使得
M
(
x
)
h
(
x
)
>
0
M(x)h(x)>0
M
(
x
)
h
(
x
)
>
0
,从而
∫
a
b
M
(
x
)
h
(
x
)
d
x
>
0
\int_a^bM(x)h(x)\text{d}x>0
∫
a
b
M
(
x
)
h
(
x
)
d
x
>
0
,假设不成立。
-
证明2:不存在
M(
x
)
M(x)
M
(
x
)
使得若
h(
x
)
h(x)
h
(
x
)
为任意函数时均有
∫a
b
M
(
x
)
h
(
x
)
d
x
=
C
≠
0
\int_a^bM(x)h(x)\text{d}x=C\neq0
∫
a
b
M
(
x
)
h
(
x
)
d
x
=
C
=
0
。
同理令
h
(
x
)
=
k
/
M
(
x
)
h(x)=k/M(x)
h
(
x
)
=
k
/
M
(
x
)
,则
∫
a
b
M
(
x
)
h
(
x
)
d
x
=
k
(
b
−
a
)
≢
C
\int_a^bM(x)h(x)\text{d}x=k(b-a)\not\equiv C
∫
a
b
M
(
x
)
h
(
x
)
d
x
=
k
(
b
−
a
)
≡
C
假设不成立。
可交换性证明
- 变分和微分
d
d
x
δ
y
=
d
d
x
(
ϵ
η
(
x
)
)
=
ϵ
d
d
x
η
(
x
)
δ
d
d
x
y
=
y
′
(
x
)
−
y
0
′
(
x
)
=
η
′
(
x
)
\begin{aligned} &\frac{\text{d}}{\text{d}x}\delta y=\frac{\text{d}}{\text{d}x}(\epsilon\eta(x)) =\epsilon\frac{\text{d}}{\text{d}x}\eta(x) \\ &\delta\frac{\text{d}}{\text{d}x}y=y'(x)-y_0′(x)=\eta'(x) \end{aligned}
d
x
d
δy
=
d
x
d
(
ϵη
(
x
))
=
ϵ
d
x
d
η
(
x
)
δ
d
x
d
y
=
y
′
(
x
)
−
y
0
′
(
x
)
=
η
′
(
x
)
- 变分和积分
δ
∫
a
b
y
(
x
)
d
x
=
∫
a
b
y
(
x
)
d
x
−
∫
a
b
y
0
(
x
)
d
x
=
∫
a
b
y
(
x
)
−
y
0
(
x
)
d
x
=
∫
a
b
δ
y
(
x
)
d
x
\begin{aligned} &\delta\int_a^by(x)\text{d}x=\int_a^by(x)\text{d}x-\int_a^by_0(x)\text{d}x =\int_a^by(x)-y_0(x)\text{d}x=\int_a^b\delta y(x)\text{d}x \end{aligned}
δ
∫
a
b
y
(
x
)
d
x
=
∫
a
b
y
(
x
)
d
x
−
∫
a
b
y
0
(
x
)
d
x
=
∫
a
b
y
(
x
)
−
y
0
(
x
)
d
x
=
∫
a
b
δy
(
x
)
d
x
泛函的拉格朗日乘子法证明
J
=
∫
a
b
f
(
y
,
y
′
)
d
x
J=\int_a^bf(y,y’)\text{d}x
J
=
∫
a
b
f
(
y
,
y
′
)
d
x
若满足约束
g
(
y
,
y
′
)
=
0
g(y,y’)=0
g
(
y
,
y
′
)
=
0
,则
δ
g
=
∂
g
∂
y
δ
y
+
∂
g
∂
y
′
δ
y
′
=
0
(
2
−
1
)
δ
J
=
∫
a
b
δ
f
(
y
,
y
′
)
d
x
+
λ
δ
g
(
y
,
y
′
)
=
0
(
2
−
2
)
δ
f
(
y
,
y
′
)
=
∂
f
∂
y
δ
y
+
∂
f
∂
y
′
δ
y
′
=
0
(
2
−
3
)
\begin{aligned} & \delta g=\frac{\partial g}{\partial y}\delta y+\frac{\partial g}{\partial y’}\delta y’=0\quad(2-1) \\ & \delta J=\int_a^b\delta f(y,y’)\text{d}x+\lambda\delta g(y,y’)=0\quad(2-2) \\ & \delta f(y,y’)=\frac{\partial f}{\partial y}\delta y+\frac{\partial f}{\partial y’}\delta y’=0\quad(2-3) \\ \end{aligned}
δ
g
=
∂
y
∂
g
δy
+
∂
y
′
∂
g
δ
y
′
=
0
(
2
−
1
)
δ
J
=
∫
a
b
δ
f
(
y
,
y
′
)
d
x
+
λ
δ
g
(
y
,
y
′
)
=
0
(
2
−
2
)
δ
f
(
y
,
y
′
)
=
∂
y
∂
f
δy
+
∂
y
′
∂
f
δ
y
′
=
0
(
2
−
3
)
由(2-1)(2-3)式可得
∂
f
∂
y
=
−
λ
∂
g
∂
y
∂
f
∂
y
′
=
−
λ
∂
g
∂
y
′
δ
f
(
y
,
y
′
)
=
∂
f
∂
y
δ
y
+
∂
f
∂
y
′
δ
y
′
=
∂
f
∂
y
δ
y
+
∂
f
∂
y
′
(
−
∂
g
∂
y
∂
g
∂
y
′
)
=
(
∂
f
∂
y
+
λ
∂
g
∂
y
)
δ
y
\begin{aligned} \frac{\partial f}{\partial y}&=-\lambda\frac{\partial g}{\partial y} \\ \frac{\partial f}{\partial y’}&=-\lambda\frac{\partial g}{\partial y’} \\ \delta f(y,y’)&=\frac{\partial f}{\partial y}\delta y +\frac{\partial f}{\partial y’}\delta y’ \\ &=\frac{\partial f}{\partial y}\delta y +\frac{\partial f}{\partial y’}(-\frac{\frac{\partial g}{\partial y}}{\frac{\partial g}{\partial y’}}) \\ &=(\frac{\partial f}{\partial y}+\lambda\frac{\partial g}{\partial y})\delta y \\ \end{aligned}
∂
y
∂
f
∂
y
′
∂
f
δ
f
(
y
,
y
′
)
=
−
λ
∂
y
∂
g
=
−
λ
∂
y
′
∂
g
=
∂
y
∂
f
δy
+
∂
y
′
∂
f
δ
y
′
=
∂
y
∂
f
δy
+
∂
y
′
∂
f
(
−
∂
y
′
∂
g
∂
y
∂
g
)
=
(
∂
y
∂
f
+
λ
∂
y
∂
g
)
δy
于是可以构造拉格朗日函数
L
(
y
,
y
′
)
=
f
(
y
,
y
′
)
+
λ
g
(
y
,
y
′
)
∂
L
∂
y
=
∂
f
∂
y
+
λ
∂
g
∂
y
\begin{aligned} & L(y,y’)=f(y,y’)+\lambda g(y,y’) \\ & \frac{\partial L}{\partial y}=\frac{\partial f}{\partial y}+\lambda\frac{\partial g}{\partial y} \\ \end{aligned}
L
(
y
,
y
′
)
=
f
(
y
,
y
′
)
+
λ
g
(
y
,
y
′
)
∂
y
∂
L
=
∂
y
∂
f
+
λ
∂
y
∂
g
需要注意的是,多元函数中
z
=
f
(
x
0
,
y
0
)
z=f(x_0,y_0)
z
=
f
(
x
0
,
y
0
)
是个点,所以
λ
\lambda
λ
是个常数;而
δ
y
\delta y
δy
是个函数,所以泛函中的
λ
\lambda
λ
也是个函数。