Lesson 3 of 15

Partial Derivatives

Partial Derivatives

Functions in differential geometry often take multiple arguments — coordinates on a manifold. The partial derivative ∂if\partial_i f differentiates ff with respect to its ii-th argument while holding all others fixed.

In functional notation, ∂i\partial_i is itself a higher-order function:

∂if(x0,x1,…)=lim⁡h→0f(…,xi+h,…)−f(…,xi−h,…)2h\partial_i f(x_0, x_1, \ldots) = \lim_{h \to 0} \frac{f(\ldots, x_i + h, \ldots) - f(\ldots, x_i - h, \ldots)}{2h}

The Lagrangian

The book opens with the Lagrange equations of motion. For a Lagrangian L(t,q,q˙)L(t, q, \dot{q}):

ddt(∂2L)−∂1L=0\frac{d}{dt}(\partial_2 L) - \partial_1 L = 0

Here ∂1L\partial_1 L is the partial derivative of LL with respect to its second argument (position qq), and ∂2L\partial_2 L is the partial with respect to its third argument (velocity q˙\dot{q}). Index 0 is time.

For the harmonic oscillator L=12q˙2−12kq2L = \frac{1}{2}\dot{q}^2 - \frac{1}{2}kq^2:

  • ∂1L=−kq\partial_1 L = -kq
  • ∂2L=q˙\partial_2 L = \dot{q}

Your Task

Implement partial(i, f) that returns the partial derivative of f with respect to argument i (0-indexed).

Python runtime loading...
Loading...
Click "Run" to execute your code.