向量场与流Vector Fields & Flows
给空间里每一点配一个向量,就得到一个向量场:风速、水流、磁场,或者"机器人在这里应该朝哪走"的指令。让一个粒子顺着场漂移,它走出的曲线叫积分曲线,所有粒子一起漂移的整体运动叫流。动力系统、速度控制器、势场导航,乃至最新的流匹配 (flow matching) 机器人策略,说的都是同一件事:用一个向量场描述运动。 Attach a vector to every point of space and you have a vector field: wind, water current, a magnetic field, or the instruction "which way should the robot go from here?". Let a particle drift with the field and its path is an integral curve; the combined motion of all particles is the flow. Dynamical systems, velocity controllers, potential-field navigation and even the latest flow-matching robot policies all say the same thing: describe motion with a vector field.
1为什么机器人需要它Why robots need this
上一节的梯度只是向量场的一种特例。机器人学里到处是向量场:
- 动力系统:状态 \(\mathbf x\) 的变化率由状态本身决定,\(\dot{\mathbf x}=F(\mathbf x)\)。摆、四旋翼、倒立摆、闭环控制系统都是这个形式(2.5 节),它们的"相图"就是向量场。
- 速度/行为控制器:把"该往哪走"写成一个场 \(F(\mathbf x)\),机器人只要处处顺着场走:势场导航、沿曲线路径跟踪、阻抗控制里的吸引子,都是向量场控制器。
- 学习得到的策略:模仿学习里的动态运动基元 (DMP)、扩散与流匹配策略,学的就是一个向量场 \(v_\theta(\mathbf x,t)\),推理时沿着它积分,把噪声"流"成动作。
- 稳定性与不确定性传播:不动点附近的行为由雅可比(3.3 节)决定;一团初始状态的体积怎样变化由散度决定。
这一节搭起一个共同语言:场、流、不动点、线性化、散度与旋度,以及把"流"变成可计算轨迹的数值积分。
The gradient of the last lesson is only one special vector field. Robotics is full of them:
- Dynamical systems: the rate of change of the state \(\mathbf x\) is determined by the state itself, \(\dot{\mathbf x}=F(\mathbf x)\). Pendulums, quadrotors, inverted pendulums and closed-loop control systems all take this form (Lesson 2.5), and their "phase portraits" are vector fields.
- Velocity and behavior controllers: write "where to go" as a field \(F(\mathbf x)\) and have the robot follow it everywhere. Potential-field navigation, path following along a curve, and attractors in impedance control are all vector-field controllers.
- Learned policies: dynamic movement primitives (DMPs) in imitation learning, and diffusion and flow-matching policies, learn a vector field \(v_\theta(\mathbf x,t)\); at inference one integrates along it, "flowing" noise into actions.
- Stability and uncertainty propagation: behavior near a fixed point is set by the Jacobian (Lesson 3.3); how a cloud of initial states changes volume is set by the divergence.
This lesson builds a shared vocabulary: fields, flows, fixed points, linearization, divergence and curl, and the numerical integration that turns a flow into computable trajectories.
2直觉:撒一把沙子到河里Intuition: sprinkle sand into a river
想象一条河,每个位置的水都有一个流速:这就是向量场 \(F(x,y)\)。往河里撒一把沙子,每一粒沙子都沿着当地的流速运动,走出一条积分曲线:它在每一点的速度恰好是该点的场向量。整条河的沙子一起运动,就是流 \(\varphi_t\):\(\varphi_t(\mathbf x_0)\) 表示 \(t\) 秒前放在 \(\mathbf x_0\) 的沙子现在的位置。
两条积分曲线永远不会相交(每点只有一个方向可走);场为零的点是不动点,放在那里的沙子永远不动。下图给出几种典型的场,让粒子顺着场漂移。点击地图放下一个高亮的粒子,观察它的轨迹;移动鼠标,读出任一点的场向量。
Picture a river whose water has a velocity at every position: that is a vector field \(F(x,y)\). Sprinkle sand into it and each grain moves with the local current, tracing an integral curve whose velocity at every point is exactly the field vector there. The sand as a whole moving together is the flow \(\varphi_t\): \(\varphi_t(\mathbf x_0)\) is where the grain dropped at \(\mathbf x_0\) has got to after \(t\) seconds.
Two integral curves never cross (there is just one way to go from each point); a point where the field vanishes is a fixed point, and a grain placed there never moves. The figure below offers several typical fields and lets particles drift along them. Click the map to drop a highlighted particle and watch its path; move the pointer to read the field vector anywhere.
3动手玩:粒子随流漂移Play: particles riding a flow
- 点击放下 3 个粒子,在"极限环"场里分别从圆内、圆外出发:它们最后都去了哪里?Click to drop 3 particles in the "Limit cycle" field, starting inside and outside the circle: where do they all end up?
- 用鼠标找到场向量几乎为 0 的位置(\(\|F\|<0.1\)),即不动点。试试"摆",它有几个不动点?Use the pointer to find a place where the field vector is nearly 0 (\(\|F\|<0.1\)): a fixed point. Try the "Pendulum": how many fixed points does it have?
向量场 \(F\) 与流 \(\varphi_t\) 是同一件事的两种写法:场给出瞬时速度,流给出一段时间后的位置。\(\dot{\mathbf x}=F(\mathbf x)\) 把前者变成后者,要靠积分(解 ODE)。大多数 \(F\) 没有解析解,所以实际中总是数值积分。
The field \(F\) and the flow \(\varphi_t\) are two ways of writing the same thing: the field gives the instantaneous velocity, the flow gives the position after some time. \(\dot{\mathbf x}=F(\mathbf x)\) turns one into the other by integration (solving the ODE). Most fields have no closed-form solution, so in practice we integrate numerically.
4第二视角:不动点附近的雅可比,以及散度与旋度Second views: the Jacobian at a fixed point, and divergence and curl
线性化:迹–行列式图Linearization: the trace–determinant diagram
在不动点 \(\mathbf x^*\) 附近,3.3 节说过 \(F\) 像它的雅可比:令 \(\boldsymbol\delta=\mathbf x-\mathbf x^*\),则 \(\dot{\boldsymbol\delta}\approx J\boldsymbol\delta\)。所以不动点附近的流,就是线性系统 \(\dot{\mathbf x}=A\mathbf x\) 的流(\(A=J(\mathbf x^*)\))。它的形状只由 \(A\) 的特征值(1.11 节)决定,而二维的特征值 \(\lambda=\tfrac T2\pm\sqrt{\tfrac{T^2}{4}-D}\) 只取决于两个数:迹 \(T=\operatorname{tr}A\) 与行列式 \(D=\det A\)。
左图是迹–行列式平面,拖动黄点;右图是对应的相图。抛物线 \(D=T^2/4\) 上方的特征值是复数(螺旋),下方是实数(结点);\(D<0\) 是鞍点;\(T=0\) 且 \(D>0\) 是中心(闭合轨道)。把"旋转坐标"滑块拖一拖:相图转起来,而类型不变,因为 \(T\) 与 \(D\) 在旋转下不变。
Near a fixed point \(\mathbf x^*\), Lesson 3.3 says \(F\) looks like its Jacobian: with \(\boldsymbol\delta=\mathbf x-\mathbf x^*\), \(\dot{\boldsymbol\delta}\approx J\boldsymbol\delta\). So the flow near a fixed point is the flow of the linear system \(\dot{\mathbf x}=A\mathbf x\) with \(A=J(\mathbf x^*)\). Its shape is decided by the eigenvalues of \(A\) (Lesson 1.11), and in 2D the eigenvalues \(\lambda=\tfrac T2\pm\sqrt{\tfrac{T^2}{4}-D}\) depend on just two numbers: the trace \(T=\operatorname{tr}A\) and the determinant \(D=\det A\).
The left panel is the trace–determinant plane; drag the amber point. The right panel is the matching phase portrait. Above the parabola \(D=T^2/4\) the eigenvalues are complex (spirals), below it real (nodes); \(D<0\) is a saddle; \(T=0\) with \(D>0\) is a center (closed orbits). Drag the "rotate coordinates" slider: the portrait turns while its type stays, because \(T\) and \(D\) are invariant under rotation.
- 造一个中心:\(T\approx0\),\(D>0.3\)。轨道是闭合的椭圆,粒子永远不会远离也不会靠近原点。Make a center: \(T\approx0\), \(D>0.3\). The orbits are closed ellipses; particles never drift away or settle at the origin.
- 造一个鞍点(\(D<-0.3\)):只有沿一条特征向量直线的粒子能到达原点,其余的都被甩开。Make a saddle (\(D<-0.3\)): only particles on one eigenvector line reach the origin; all others are flung away.
- 造一个不稳定螺旋:\(T>0.3\) 且在抛物线上方。再把它变成稳定螺旋:要改变哪个量的符号?Make an unstable spiral: \(T>0.3\) and above the parabola. Then make it a stable spiral: which quantity changes sign?
散度与旋度:一小块流体怎样变形Divergence and curl: how a small patch of fluid deforms
把一小圈粒子(紫色圆)撒在点 \(\mathbf c\) 附近,让它们随流漂移一段时间 \(\tau\)。这一小块会被搬运,同时变形:面积放大或缩小,朝向转动。两个局部量描述了这件事:散度 \(\operatorname{div}F=\partial_xF_x+\partial_yF_y\)(面积的相对变化率)和二维旋度 \(\operatorname{curl}F=\partial_xF_y-\partial_yF_x\)(局部转动速率的两倍)。它们都是雅可比(3.3 节)的组合:散度是迹,旋度是反对称部分。
读数里还有两个直接用粒子圈算出来的量:通过圆周的净流出量除以面积,以及沿圆周的环量除以面积。随着圆变小,它们分别趋近于散度和旋度,这就是散度定理与格林定理的内容。
Sprinkle a small ring of particles (the purple circle) around a point \(\mathbf c\) and let it drift with the flow for a time \(\tau\). The patch is carried along and also deformed: its area grows or shrinks and its orientation turns. Two local quantities describe this: the divergence \(\operatorname{div}F=\partial_xF_x+\partial_yF_y\) (the relative rate of change of area) and the 2D curl \(\operatorname{curl}F=\partial_xF_y-\partial_yF_x\) (twice the local rotation rate). Both are combinations of the Jacobian (Lesson 3.3): divergence is its trace, curl its antisymmetric part.
The readout also has two numbers computed directly from the ring of particles: the net outflow through the circle divided by the area, and the circulation around the circle divided by the area. As the circle shrinks they approach the divergence and the curl: this is the content of the divergence theorem and Green's theorem.
- 选"旋转"场,把 \(\tau\) 拉到 2 以上:小块转了很多,面积比却始终是 1。旋度不为零而散度为零意味着什么?Pick the "Rotation" field and pull \(\tau\) above 2: the patch turns a lot, yet the area ratio stays 1. What does nonzero curl with zero divergence mean?
- 选"螺旋汇"场,让面积比降到 0.3 以下。\(\exp(\operatorname{div}\cdot\tau)\) 预测得准吗?Pick the "Spiral sink" field and bring the area ratio below 0.3. Does \(\exp(\operatorname{div}\cdot\tau)\) predict it well?
- 在"极限环"场里,把圆心拖到散度从正变负的位置附近(\(|\operatorname{div}|<0.3\))。这里 \(\operatorname{div}F=2-4r^2\),变号的圆是 \(r\approx0.71\),不是粒子最终绕行的极限环 \(r=1\):在 \(0.71<r<1\) 之间面积在收缩,粒子却仍在向外走。散度只说面积怎样变,不说轨道最后停在哪里。In the "Limit cycle" field drag the center close to where the divergence changes sign (\(|\operatorname{div}|<0.3\)). Here \(\operatorname{div}F=2-4r^2\), so the sign change is on the circle \(r\approx0.71\), not on the limit cycle \(r=1\) where particles end up: between \(0.71<r<1\) area shrinks, yet particles still move outward. Divergence tells you how area changes, not where orbits settle.
5再看数学The math
提示:把鼠标悬停在公式中带底色的符号上,FIG 3 中对应的元素会被高亮。Tip: hover the highlighted symbols in the formulas; the matching element in FIG 3 lights up.
向量场、积分曲线与流Vector fields, integral curves and flows
向量场是映射 \(F:\R^n\to\R^n\),每点一个向量。积分曲线 \(\mathbf x(t)\) 满足 ODE(2.5 节),流 \(\varphi_t\) 把初值映到 \(t\) 时刻的解:
A vector field is a map \(F:\R^n\to\R^n\), one vector per point. An integral curve \(\mathbf x(t)\) solves the ODE (Lesson 2.5), and the flow \(\varphi_t\) sends an initial value to the solution at time \(t\):
若 \(F\) 满足 Lipschitz 条件(例如连续可微,只要雅可比有界),解存在且唯一(Picard–Lindelöf 定理),所以积分曲线不会相交。复合性质 \(\varphi_{t+s}=\varphi_t\circ\varphi_s\) 说的是"漂移 \(s\) 秒再漂移 \(t\) 秒,等于漂移 \(t+s\) 秒"。
If \(F\) is Lipschitz (for instance continuously differentiable with bounded Jacobian), solutions exist and are unique (Picard–Lindelöf), so integral curves cannot cross. The composition rule \(\varphi_{t+s}=\varphi_t\circ\varphi_s\) says "drift for \(s\) seconds and then \(t\) more equals drifting for \(t+s\)".
不动点、线性化与分类Fixed points, linearization and classification
\(e^{At}\) 是矩阵指数(5.6 节会把它推广到李群)。若所有特征值实部为负,不动点渐近稳定;只要有一个实部为正,就不稳定。二维时:\(D<0\) 鞍点;\(D>0,\,T<0\) 稳定(\(T^2>4D\) 结点,\(T^2<4D\) 螺旋);\(D>0,\,T>0\) 不稳定;\(T=0,\,D>0\) 中心。中心是线性化的临界情形:线性系统是闭合轨道,非线性系统可能是稳定或不稳定螺旋,需要看更高阶项。这就是线性化的"哈特曼–格罗曼"定理成立的范围:对特征值实部都不为零的不动点(双曲不动点),线性化给出正确的定性图像。
\(e^{At}\) is the matrix exponential (Lesson 5.6 generalizes it to Lie groups). If all eigenvalues have negative real part the fixed point is asymptotically stable; if any has positive real part it is unstable. In 2D: \(D<0\) saddle; \(D>0,\,T<0\) stable (\(T^2>4D\) node, \(T^2<4D\) spiral); \(D>0,\,T>0\) unstable; \(T=0,\,D>0\) center. A center is the borderline case of linearization: the linear system has closed orbits but the nonlinear one may be a stable or unstable spiral, decided by higher-order terms. This is the scope of the Hartman–Grobman theorem: at hyperbolic fixed points (no eigenvalue with zero real part) the linearization gives the right qualitative picture.
散度、旋度与流的体积变化Divergence, curl and how the flow changes volume
流的雅可比 \(\Phi_t=D\varphi_t\) 描述一小块如何被拉伸和旋转,它满足 \(\dot\Phi_t=J_F(\varphi_t)\,\Phi_t\)(把 \(\mathbf x(t)\) 的方程对初值求导)。由 \(\tfrac{d}{dt}\det\Phi=\operatorname{tr}(J_F)\det\Phi\)(Liouville 公式)得
The flow's Jacobian \(\Phi_t=D\varphi_t\) describes how a small patch is stretched and rotated, and satisfies \(\dot\Phi_t=J_F(\varphi_t)\,\Phi_t\) (differentiate the ODE with respect to the initial value). From \(\tfrac{d}{dt}\det\Phi=\operatorname{tr}(J_F)\det\Phi\) (Liouville's formula),
用 3.3 节的读法:\(\det\Phi_\tau\) 就是流在这一小块上的面积缩放倍数。对线性场 \(\dot{\mathbf x}=A\mathbf x\),\(\det e^{A\tau}=e^{\tau\operatorname{tr}A}\),所以散度 \(=\operatorname{tr}A\),处处相同。旋度的几何含义:刚体转动 \(F=(-\omega y,\omega x)\) 的旋度是 \(2\omega\),即旋度是转速的两倍。
In the language of Lesson 3.3, \(\det\Phi_\tau\) is the area scale factor the flow applies to that patch. For a linear field \(\dot{\mathbf x}=A\mathbf x\), \(\det e^{A\tau}=e^{\tau\operatorname{tr}A}\), so the divergence \(=\operatorname{tr}A\), the same everywhere. The geometry of curl: a rigid rotation \(F=(-\omega y,\omega x)\) has curl \(2\omega\), i.e. curl is twice the rotation rate.
与前几节的联系:梯度场没有旋度。若 \(F=\nabla f\),则 \(\operatorname{curl}F=\partial_x\partial_yf-\partial_y\partial_xf=0\)(3.1 节的混合偏导相等),沿任何闭曲线的环量 \(\oint F\cdot d\mathbf r=0\),做功与路径无关。反过来,"旋转"这样旋度非零的场不可能是任何函数的梯度,不能用势场来描述,这也是势场导航"只能下山、不会绕圈"的原因。梯度流 \(\dot{\mathbf x}=-\nabla f\) 的雅可比 \(-H\) 是对称矩阵(3.5 节),特征值全是实数,不会出现螺旋。
Connections to earlier lessons: gradient fields have no curl. If \(F=\nabla f\) then \(\operatorname{curl}F=\partial_x\partial_yf-\partial_y\partial_xf=0\) (equality of mixed partials, Lesson 3.1), the circulation \(\oint F\cdot d\mathbf r\) around any closed loop is zero, and work is path-independent. Conversely a field with non-zero curl, like a rotation, can never be the gradient of any function and cannot be described by a potential, which is why potential-field navigation "only goes downhill and never circles". The Jacobian of a gradient flow \(\dot{\mathbf x}=-\nabla f\) is \(-H\), a symmetric matrix (Lesson 3.5) with real eigenvalues, so no spirals appear.
6把流变成数字:数值积分Turning a flow into numbers: numerical integration
计算机只能一步一步走。最简单的欧拉法 \(\mathbf x_{k+1}=\mathbf x_k+hF(\mathbf x_k)\) 假设场在一步内不变;Heun 法(二阶)取起点与终点预估的平均;经典 RK4(四阶)取四个采样点的加权平均:
下图在两个场上比较这三种方法与精确解。旋转场的精确流是一个圆;梯度流 \(\dot{\mathbf x}=-\nabla f\)(\(f=\tfrac12(x^2+6y^2)\))的精确解是指数衰减。把步长 \(h\) 拉大,会发生有意思的事。
A computer can only take steps. The simplest, Euler's method \(\mathbf x_{k+1}=\mathbf x_k+hF(\mathbf x_k)\), assumes the field is constant over a step; Heun's method (second order) averages the predictions at start and end; the classic RK4 (fourth order) takes a weighted average of four samples:
The figure compares the three methods with the exact solution on two fields. The exact flow of the rotation field is a circle; the exact solution of the gradient flow \(\dot{\mathbf x}=-\nabla f\) (\(f=\tfrac12(x^2+6y^2)\)) is exponential decay. Make the step \(h\) larger and interesting things happen.
- 在"旋转场"上让欧拉法转完一圈后半径超过 1.5:它本该走一个圆,却螺旋着飞了出去。On the "Rotation field", make Euler's radius exceed 1.5 after one revolution: it should trace a circle but spirals outward instead.
- 在"梯度流"上找一个 \(h\):欧拉和 Heun 发散(越走越远),而 RK4 仍然收敛。On the "Gradient flow" find an \(h\) for which Euler and Heun diverge (drifting farther away) while RK4 still converges.
为什么欧拉法会让旋转场的粒子越转越远?旋转场的 \(A=\begin{bmatrix}0&-1\\1&0\end{bmatrix}\),欧拉一步是 \(\mathbf x\leftarrow(I+hA)\mathbf x\),而 \(I+hA\) 把每个向量放大 \(\sqrt{1+h^2}\) 倍,每一步都向外"多走一点",\(n\) 步后半径是 \((1+h^2)^{n/2}\)。对 \(\dot x=\lambda x\)(\(\lambda<0\)),欧拉要求 \(|1+h\lambda|<1\),即 \(h<2/|\lambda|\)。
梯度下降就是欧拉法。\(\mathbf x\leftarrow\mathbf x-\eta\nabla f\) 是梯度流 \(\dot{\mathbf x}=-\nabla f\) 的欧拉离散,步长 \(\eta\) 就是 \(h\),\(\lambda\) 是 Hessian 的特征值。所以 3.5 节里"\(\eta<2/\lambda_{\max}\)"这条稳定性条件,正是这里的 \(h<2/|\lambda|\)。
Why does Euler's method send the rotation-field particle ever outward? For the rotation field \(A=\begin{bmatrix}0&-1\\1&0\end{bmatrix}\), an Euler step is \(\mathbf x\leftarrow(I+hA)\mathbf x\), and \(I+hA\) scales every vector by \(\sqrt{1+h^2}\): each step drifts a little outward, and after \(n\) steps the radius is \((1+h^2)^{n/2}\). For \(\dot x=\lambda x\) with \(\lambda<0\), Euler needs \(|1+h\lambda|<1\), i.e. \(h<2/|\lambda|\).
Gradient descent is Euler's method. \(\mathbf x\leftarrow\mathbf x-\eta\nabla f\) is the Euler discretization of the gradient flow \(\dot{\mathbf x}=-\nabla f\) with step \(\eta=h\) and \(\lambda\) an eigenvalue of the Hessian. So the stability condition "\(\eta<2/\lambda_{\max}\)" of Lesson 3.5 is exactly this \(h<2/|\lambda|\).
7机器人中的它:用向量场沿曲线行走In robotics: following a curve with a vector field
让无人机或移动机器人沿一条给定的闭合曲线 \(\{\alpha(\mathbf x)=0\}\) 巡航,一个简洁的做法是构造向量场:沿曲线的切向前进,同时按距离把机器人拉回曲线(Nelson 等 2007 用在固定翼无人机上,Gonçalves 等 2010 推广到任意隐式曲线):
这里 \(\hat{\mathbf n}\) 是 \(\alpha\) 的梯度方向(3.2 节:垂直于等值线,指向曲线外),\(d\) 是到曲线的有符号距离的一阶近似,\(k\) 是收敛增益,\(v_0\) 是巡航速度。机器人按 \(\dot{\mathbf x}=F(\mathbf x)\) 运动,我们用步长 \(\Delta t\) 的欧拉法离散它,就像真实控制器每个周期更新一次。曲线附近 \(\dot d\approx-v_0k\,d\),所以欧拉稳定要求 \(v_0k\,\Delta t<2\),和上一节完全一样。
To make a drone or mobile robot cruise along a given closed curve \(\{\alpha(\mathbf x)=0\}\), a neat recipe is a vector field that moves along the tangent while pulling the robot back onto the curve in proportion to its distance (Nelson et al. 2007 used it on fixed-wing UAVs; Gonçalves et al. 2010 extended it to arbitrary implicit curves):
Here \(\hat{\mathbf n}\) is the direction of the gradient of \(\alpha\) (Lesson 3.2: perpendicular to the level set, pointing out of the curve), \(d\) is a first-order approximation of the signed distance to the curve, \(k\) a convergence gain and \(v_0\) the cruising speed. The robot obeys \(\dot{\mathbf x}=F(\mathbf x)\), which we discretize with Euler steps of size \(\Delta t\), as a real controller updates once per cycle. Near the curve \(\dot d\approx-v_0k\,d\), so Euler stability needs \(v_0k\,\Delta t<2\), exactly as in the last section.
- 让机器人从曲线外较远的地方出发,最终贴着曲线走(末段横向误差 < 0.05)。Start the robot far from the curve and have it end up riding the curve (final cross-track error < 0.05).
- 把 \(v_0k\Delta t\) 推到 2 以上,让机器人颠簸(末段仍有明显误差)。再通过减小 \(\Delta t\) 修好它:这和"减小学习率"是同一个操作。Push \(v_0k\Delta t\) above 2 and make the robot chatter (a clear error at the end). Then repair it by reducing \(\Delta t\): the same move as "lowering the learning rate".
沿路径行走:固定翼无人机、AGV、无人船常用这类向量场,因为它没有"追哪个点"的问题,场天然平滑,对扰动鲁棒。动态运动基元 (DMP) 与学习的向量场:DMP 把示教轨迹编码成一个带吸引子的向量场;扩散策略 / 流匹配策略则训练神经网络 \(v_\theta(\mathbf x,t)\) 来近似一个把噪声搬运成动作的向量场,推理时用 Euler 或 RK 积分若干步(步数越少越快,但就像 FIG 4 那样精度下降)。稳定性分析:对闭环系统 \(\dot{\mathbf x}=F(\mathbf x,\mathbf u(\mathbf x))\) 在平衡点求雅可比,检查特征值实部,是最基本的稳定性检验(Lyapunov 间接法)。不确定性传播:\(\det\Phi_t\) 与 \(\Phi_t\) 本身告诉你,一团初始误差沿着流被拉伸成什么样(4.5 节)。
Path following: fixed-wing UAVs, AGVs and surface vessels often use such fields, because there is no "which point to chase" problem and the field is naturally smooth and robust to disturbances. DMPs and learned vector fields: a DMP encodes a demonstrated trajectory as a vector field with an attractor; diffusion and flow-matching policies train a neural network \(v_\theta(\mathbf x,t)\) to approximate a field carrying noise into actions, integrating it with Euler or RK for a few steps at inference (fewer steps are faster but less accurate, as in FIG 4). Stability analysis: for a closed loop \(\dot{\mathbf x}=F(\mathbf x,\mathbf u(\mathbf x))\), compute the Jacobian at an equilibrium and check the real parts of the eigenvalues: the most basic stability test (Lyapunov's indirect method). Uncertainty propagation: \(\det\Phi_t\) and \(\Phi_t\) itself tell you what shape a cloud of initial error is stretched into along the flow (Lesson 4.5).
8常见误区Common pitfalls
箭头是速度,不是位移。粒子走一小步后位置变了,所在处的箭头也变了,所以轨迹是把箭头"连起来"的曲线(积分曲线),通常是弯的。用大步长直接按初始箭头走一步,就是 FIG 4 里欧拉法的误差来源。
Arrows are velocities, not displacements. After a small step the particle is somewhere else and the arrow there differs, so the trajectory is the curve that "links the arrows together" (the integral curve), usually bent. Taking one big step along the initial arrow is exactly the source of Euler's error in FIG 4.
线性化出 \(T=0,D>0\)(纯虚特征值)时,真实的非线性系统可能是稳定螺旋、不稳定螺旋,也可能真是中心。"摆"的小幅摆动是真中心(因为它有守恒量),但一般情况不能下结论。
When linearization gives \(T=0,D>0\) (purely imaginary eigenvalues), the true nonlinear system may be a stable spiral, an unstable one, or a genuine center. The small swings of a pendulum are a true center (there is a conserved quantity), but in general no conclusion follows.
散度只管面积(体积)怎么变。旋转、剪切、鞍形场的散度都是 0,但粒子运动得很剧烈,只是面积守恒。反过来,不动点上的场为 0,但散度可以不为 0(FIG 3 的"螺旋汇"在原点)。
Divergence only governs how area (volume) changes. Rotation, shear and saddle fields all have zero divergence yet their particles move vigorously, merely preserving area. Conversely, the field vanishes at a fixed point while the divergence there need not (the "Spiral sink" of FIG 3 at the origin).
步长太大会不稳定、不精确;太小则浪费计算,且在实时控制里受限于周期。更重要的是方法的阶数:RK4 在 \(h=0.3\) 时可能比欧拉在 \(h=0.01\) 更准,代价是每步多算三次 \(F\)。对"对时间离散敏感"的闭环系统(FIG 5),应该用稳定性条件 \(v_0k\Delta t<2\) 选增益或周期,而不是只靠试。
Too large a step is unstable and inaccurate; too small wastes computation and is capped by the cycle time in real-time control. More important is the order of the method: RK4 at \(h=0.3\) can be more accurate than Euler at \(h=0.01\), at the cost of three extra evaluations of \(F\) per step. For closed loops that are sensitive to time discretization (FIG 5), choose the gain or the cycle time from the stability condition \(v_0k\Delta t<2\) rather than by trial alone.
9小练习Check yourself
10延伸阅读Further reading
- Khan Academy, Multivariable Calculus — Grant Sanderson(3Blue1Brown)讲解的向量场、散度与旋度的直观图像Grant Sanderson's (3Blue1Brown) intuitive pictures of vector fields, divergence and curl
- S. Strogatz, Nonlinear Dynamics and Chaos — 相平面、线性化、迹–行列式分类与极限环(第 5–7 章)The phase plane, linearization, the trace–determinant classification and limit cycles (Chs. 5–7)
- H. Khalil, Nonlinear Systems — 稳定性与 Lyapunov 方法(本节"间接法"的出处)Stability and Lyapunov methods (the source of the "indirect method" mentioned here)
- D. R. Nelson, D. B. Barber, T. W. McLain & R. W. Beard, Vector Field Path Following for Miniature Air Vehicles, IEEE Trans. Robotics 23(3), 2007 — FIG 5 中向量场路径跟踪的经典应用The classic application behind the path following of FIG 5
- Y. Lipman, R. Chen, H. Ben-Hamu, M. Nickel & M. Le, Flow Matching for Generative Modeling, ICLR 2023 — 用神经网络学习向量场来生成数据,机器人流匹配策略的基础Learning a vector field with a neural network to generate data, the basis of robotic flow-matching policies