偏导数与梯度Partial Derivatives & Gradients
一个输出受多个输入影响时,怎样描述当前位置的上升方向?How can we describe the local uphill direction when an output depends on multiple inputs?
前置知识:Prerequisites: B04:点积与方向;B07:导数。B04: dot products and direction; B07: derivatives.
复习前置:Review prerequisites: B04 · 点积、夹角与投影Dot Products, Angles & Projections · B07 · 从平均变化率到导数From Average Rate of Change to Derivatives
学完后你能:After this lesson you can: 从切片求偏导,组成梯度,并说明梯度为零的含义。Find partial derivatives from slices, form a gradient, and interpret a zero gradient.
动手观察Explore
调节探针的 x、y,观察等高线、梯度箭头和两个坐标切片的斜率。Adjust the probe’s x and y to compare contours, the gradient arrow and the slopes of two coordinate slices.
从观察到解释From observation to explanation
先固定一个输入Hold one input fixed
对于 f(x,y)=x²+y²,固定 y=1 后,只沿 x 观察得到一条切片 x²+1;其斜率是 2x。固定 x 后沿 y 的切片斜率是 2y。For f(x,y)=x²+y², fixing y=1 gives the x-slice x²+1 with slope 2x. Holding x fixed gives a y-slice with slope 2y.
把斜率组成箭头Turn slopes into an arrow
在 (1,2) 两个偏导分别是 2 和 4,因此梯度为 (2,4)。箭头指向局部上升最快的欧氏单位方向;其长度反映这个方向的局部变化率。At (1,2) the partial derivatives are 2 and 4, so the gradient is (2,4). The arrow points along the locally steepest Euclidean unit direction; its length gives that local rate.
等高线与零梯度Contours and zero gradients
同一等高线上的输出相同;光滑且梯度非零时,梯度垂直于该线。零梯度只表示一阶变化率为零:鞍点也可能满足这一条件。All points on a contour have the same output; at a smooth point with a nonzero gradient, the gradient is perpendicular to it. A zero gradient only means first-order rates vanish; saddle points can have it too.
公式与符号Formula and symbols
f(x,y) 是一个数值输出;∂f/∂x 是固定 y 后沿 x 的变化率,∂f/∂y 类似;∇f 将两个偏导组成梯度向量。f(x,y) is a scalar output; ∂f/∂x is the rate along x with y held fixed, and ∂f/∂y is analogous. ∇f combines the partial derivatives into the gradient vector.
留意这个区别Watch for this
最陡是局部、欧氏单位方向下的结论。梯度为零不能单独证明是最低点。Steepest is a local statement for Euclidean unit directions. A zero gradient alone does not prove a minimum.
继续探索Explore further
课后练习
检验你的理解