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
so
∂ₜ is computed by automatic differentiation, so the AD backend extension must be loaded.
using CTLie # Lift, ad, Poisson, ∂ₜ, @Lie
using CTBase: Data # Data.VectorField, Data.Hamiltonian, …
# AD backend: CTBase's DifferentiationInterface extension + ForwardDiff
using DifferentiationInterface: DifferentiationInterface
using ForwardDiff: ForwardDiffThe result is always non-autonomous
Differentiating with respect to 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.
f = (t, x) -> t * x[1] + x[2]^2
df = ∂ₜ(f)
df(2.0, [1.0, 3.0]) # ∂/∂t (t*x₁ + x₂²) = x₁1.0On typed vector fields
For a VectorField, ∂ₜ returns a new VectorField that is NonAutonomous and OutOfPlace.
X = Data.VectorField((t, x) -> t .* x; is_autonomous=false)
dX = ∂ₜ(X)
dX(2.0, [1.0, 2.0]) # ∂/∂t (t·x) = x2-element Vector{Float64}:
1.0
2.0An autonomous field has zero time derivative — but note the result is still read with a leading t:
Xa = Data.VectorField(x -> [x[2], -x[1]]; is_autonomous=true)
dXa = ∂ₜ(Xa)
dXa(0.0, [1.0, 2.0]) # zero2-element Vector{Float64}:
0.0
0.0On typed Hamiltonians
For a Hamiltonian, ∂ₜ returns a NonAutonomous Hamiltonian.
H = Data.Hamiltonian((t, x, p) -> t * p + x^2; is_autonomous=false)
dH = ∂ₜ(H)
dH(2.0, 1.0, 0.5) # ∂/∂t (t·p + x²) = p0.5On typed Hamiltonian vector fields
For a HamiltonianVectorField, whose value is the pair ∂ₜ returns a NonAutonomous HamiltonianVectorField differentiating both components. Here the state is one-dimensional, hence scalar:
Z = Data.HamiltonianVectorField(
(t, x, p) -> (t * p, -t * x);
is_autonomous=false,
)
dZ = ∂ₜ(Z)
dZ(2.0, 1.0, 0.5) # ∂/∂t (t·p, -t·x) = (p, -x)(0.5, -1.0)Out-of-place only
∂ₜ on a typed object requires OutOfPlace mutability; an in-place field raises an IncorrectArgument error. See Limitations & configuration.
See also
∂ₜ— full docstring and method list.Poisson bracket — the other half of the total time derivative.