Skip to content

Poisson bracket ​

The Poisson bracket of two Hamiltonians and on the cotangent bundle is

It is the symplectic counterpart of the Lie bracket and is central to Hamiltonian mechanics:   generates the flow of the Hamiltonian system associated with , and   means is a conserved quantity along that flow.

The relevant method is Poisson. It is computed by automatic differentiation, so the AD backend extension must be loaded.

julia
using CTLie                        # Lift, ad, Poisson, ∂ₜ, @Lie
using CTBase: Data                 # VectorField, Hamiltonian, … (accessed as Data.VectorField, etc.)
using CTBase: Traits               # trait types (Autonomous, Variable, OutOfPlace, …)
using DifferentiationInterface: DifferentiationInterface  # activates the AD backend extension

Algebraic properties ​

The Poisson bracket is a Lie bracket on the space of smooth functions: it is bilinear, antisymmetric, and satisfies the Leibniz rule and the Jacobi identity.

All four hold numerically. Take three autonomous Hamiltonians:

julia
f = (x, p) -> x[2]^2 + 2x[1]^2 + p[1]^2
g = (x, p) -> 3x[2]^2 - x[1]^2 + p[2]^2 + p[1]
h = (x, p) -> x[2]^2 - 2x[1]^2 + p[1]^2 - 2p[2]^2
x, p = [1.0, 2.0], [2.0, 1.0]
julia
# antisymmetry
Poisson(f, g)(x, p) ≈ -Poisson(g, f)(x, p)
true
julia
# bilinearity
fpg = (x, p) -> f(x, p) + g(x, p)
Poisson(fpg, h)(x, p) ≈ Poisson(f, h)(x, p) + Poisson(g, h)(x, p)
true
julia
# Leibniz rule
fg = (x, p) -> f(x, p) * g(x, p)
Poisson(fg, h)(x, p) ≈ Poisson(f, h)(x, p) * g(x, p) + f(x, p) * Poisson(g, h)(x, p)
true
julia
# Jacobi identity
Poisson(f, Poisson(g, h))(x, p) +
Poisson(g, Poisson(h, f))(x, p) +
Poisson(h, Poisson(f, g))(x, p) ≈ 0.0
true

On plain functions ​

The traits come from the is_autonomous / is_variable keywords.

Autonomous — H(x, p) ​

julia
H = (x, p) -> p[1]^2 / 2 + x[1]^2
G = (x, p) -> x[1] * p[1]
Poisson(H, G)([1.0, 2.0], [0.5, 1.0])
-1.75

Non-autonomous — H(t, x, p) ​

julia
Ht = (t, x, p) -> t * x[2]^2 + 2x[1]^2 + p[1]^2 + t
Gt = (t, x, p) -> 3x[2]^2 - x[1]^2 + p[2]^2 + p[1] - t
Poisson(Ht, Gt; is_autonomous=false)(2.0, [1.0, 2.0], [2.0, 1.0])
-28.0

Variable-dependent — H(x, p, v) ​

julia
Hv = (x, p, v) -> v[1] * x[2]^2 + 2x[1]^2 + p[1]^2 + v[2]
Gv = (x, p, v) -> 3x[2]^2 - x[1]^2 + p[2]^2 + p[1] - v[2]
Poisson(Hv, Gv; is_variable=true)([1.0, 2.0], [2.0, 1.0], [4.0, 4.0])
-44.0

Non-autonomous and variable-dependent — H(t, x, p, v) ​

julia
Htv = (t, x, p, v) -> t * v[1] * x[2]^2 + 2x[1]^2 + p[1]^2 + v[2]
Gtv = (t, x, p, v) -> 3x[2]^2 - x[1]^2 + p[2]^2 + p[1] + t - v[2]
Poisson(Htv, Gtv; is_autonomous=false, is_variable=true)(2.0, [1.0, 2.0], [2.0, 1.0], [4.0, 4.0])
-76.0

On typed Hamiltonians ​

When both arguments are typed Hamiltonians, Poisson returns a typed Hamiltonian whose traits are inherited from the operands. Both must share the same time- and variable-dependence (see Limitations & configuration).

julia
F = Data.Hamiltonian((x, p) -> p[1]^2 / 2 + x[1]^2; is_autonomous=true)
G = Data.Hamiltonian((x, p) -> x[1] * p[1]; is_autonomous=true)
B = Poisson(F, G)
Hamiltonian: autonomous, fixed (no variable)
  natural call: h(x, p)
  uniform call: h(t, x, p, v)
julia
B([1.0, 2.0], [0.5, 1.0])
-1.75

Because the result is again a Hamiltonian, Poisson brackets nest:

julia
Poisson(Poisson(F, G), G)([1.0, 2.0], [0.5, 1.0])
4.5

Connection with the Lie bracket ​

The Hamiltonian lift (see Hamiltonian lift) intertwines the Lie bracket of vector fields with the Poisson bracket of their lifts. With the sign conventions used in this package,

Verified numerically:

julia
X = Data.VectorField(x -> [x[2], 2x[1]]; is_autonomous=true)
Y = Data.VectorField(x -> [3x[2], -x[1]]; is_autonomous=true)
x0, p0 = [1.0, 2.0], [0.5, 1.0]

lhs = Poisson(Lift(X), Lift(Y))(x0, p0)   # {H_X, H_Y}
rhs = Lift(ad(X, Y))(x0, p0)              # H_[X,Y]
lhs ≈ rhs
true

See also ​