Skip to content

Partial time derivative

The operator ∂ₜ (typed \partial<tab> then \_t<tab>) computes the partial derivative with respect to time of a time-dependent object:

It is the explicit-time part of the total derivative. For a quantity evaluated along the flow of a Hamiltonian , the chain rule gives the familiar decomposition

so and the Poisson bracket together yield total time derivatives — useful, for instance, to differentiate switching functions along extremals.

∂ₜ is computed by automatic differentiation, so the AD backend extension must be loaded.

The result is always non-autonomous

Differentiating with respect to produces an object that is read at a time , so every typed result is NonAutonomous and its call signature begins with t. For an autonomous input the derivative is identically zero, but the returned object still takes t as its first argument.

On plain functions

For a Function, the first argument is taken to be time, and ∂ₜ returns a Function with the same signature.

julia
f = (t, x) -> t * x[1] + x[2]^2
df = ∂ₜ(f)
df(2.0, [1.0, 3.0])      # ∂/∂t (t*x₁ + x₂²) = x₁
1.0

On typed vector fields

For a VectorField, ∂ₜ returns a new VectorField that is NonAutonomous and OutOfPlace.

julia
X  = VectorField((t, x) -> t .* x; is_autonomous=false)
dX = ∂ₜ(X)
dX(2.0, [1.0, 2.0])      # ∂/∂t (t·x) = x
2-element Vector{Float64}:
 1.0
 2.0

An autonomous field has zero time derivative — but note the result is still read with a leading t:

julia
Xa  = VectorField(x -> [x[2], -x[1]]; is_autonomous=true)
dXa = ∂ₜ(Xa)
dXa(0.0, [1.0, 2.0])     # zero
2-element Vector{Float64}:
 0.0
 0.0

On typed Hamiltonians

For a Hamiltonian, ∂ₜ returns a NonAutonomous Hamiltonian.

julia
H  = Hamiltonian((t, x, p) -> t * p[1] + x[1]^2; is_autonomous=false)
dH = ∂ₜ(H)
dH(2.0, [1.0], [0.5])    # ∂/∂t (t·p₁ + x₁²) = p₁
0.5

On typed Hamiltonian vector fields

For a HamiltonianVectorField, ∂ₜ returns a NonAutonomous HamiltonianVectorField.

julia
Z  = HamiltonianVectorField((t, x, p) -> t .* [p[1], -x[1]]; is_autonomous=false)
dZ = ∂ₜ(Z)
dZ(2.0, [1.0], [0.5])    # ∂/∂t t·[p₁, -x₁] = [p₁, -x₁]
(0.5, -1.0)

Out-of-place only

∂ₜ on a typed object requires OutOfPlace mutability; an in-place field raises a NotImplemented error. See Limitations & configuration.

See also

  • ∂ₜ — full docstring and method list.

  • Poisson bracket — the other half of the total time derivative.