Poisson bracket
The Poisson bracket of two Hamiltonians
It is the symplectic counterpart of the Lie bracket and is central to Hamiltonian mechanics:
The relevant method is Poisson. It is computed by automatic differentiation, so the AD backend extension must be loaded.
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:
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]# antisymmetry
Poisson(f, g)(x, p) ≈ -Poisson(g, f)(x, p)true# 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# 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# Jacobi identity
Poisson(f, Poisson(g, h))(x, p) +
Poisson(g, Poisson(h, f))(x, p) +
Poisson(h, Poisson(f, g))(x, p) ≈ 0.0trueOn plain functions
The traits come from the is_autonomous / is_variable keywords.
Autonomous — H(x, p)
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.75Non-autonomous — H(t, x, p)
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.0Variable-dependent — H(x, p, v)
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.0Non-autonomous and variable-dependent — H(t, x, p, v)
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.0On 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).
F = Hamiltonian((x, p) -> p[1]^2 / 2 + x[1]^2; is_autonomous=true)
G = 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)B([1.0, 2.0], [0.5, 1.0])-1.75Because the result is again a Hamiltonian, Poisson brackets nest:
Poisson(Poisson(F, G), G)([1.0, 2.0], [0.5, 1.0])4.5Connection 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:
X = VectorField(x -> [x[2], 2x[1]]; is_autonomous=true)
Y = 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 ≈ rhstrueSee also
Poisson— full docstring and method list.The
@Liemacro — write@Lie {H, G}instead ofPoisson(H, G).