Poisson bracket
For two Hamiltonians
julia
using OptimalControlOn plain functions
julia
H(x, p) = p[1] * x[2] + p[2] * x[1]
G(x, p) = x[1]^2 + p[2]^2
B = Poisson(H, G)
x, p = [1.0, 2.0], [3.0, 4.0]
B(x, p)-20.0Antisymmetry,
julia
Poisson(H, G)(x, p) + Poisson(G, H)(x, p)0.0On typed Hamiltonians
Wrapping the inputs as Hamiltonians makes Poisson return a Hamiltonian too — it nests:
julia
HT = Hamiltonian(H)
GT = Hamiltonian(G)
BT = Poisson(HT, GT)
typeof(BT)Hamiltonian{CTLie.PoissonBracket{Hamiltonian{typeof(Main.H), CTBase.Traits.Autonomous, CTBase.Traits.Fixed}, Hamiltonian{typeof(Main.G), CTBase.Traits.Autonomous, CTBase.Traits.Fixed}, CTBase.Differentiation.DifferentiationInterface{CPU, CTBase.Strategies.StrategyOptions{@NamedTuple{ad_backend::CTBase.Options.OptionValue{AutoForwardDiff{nothing, Nothing}}}}}, CTBase.Traits.Autonomous, CTBase.Traits.Fixed}, CTBase.Traits.Autonomous, CTBase.Traits.Fixed}julia
BTT = Poisson(BT, GT) # {{H, G}, G} — a second-order bracket
BTT(x, p)-32.0The bridge to Lie brackets
— lifting turns a Poisson bracket into a Lie bracket, and vice versa:
julia
X(x) = [x[1]^2, x[2]^2]
Y(x) = [x[2], -x[1]]
Poisson(Lift(X), Lift(Y))(x, p), Lift(ad(X, Y))(x, p)(12.0, 12.0)Non-autonomous and variable forms
julia
Ht(t, x, p) = t + p[1] * x[2] + p[2] * x[1]
Gt(t, x, p) = t^2 + x[1]^2 + p[2]^2
Bt = Poisson(Ht, Gt; is_autonomous=false)
Bt(1.0, x, p)-20.0Application: singular controls
For a pseudo-Hamiltonian
giving
julia
H0(x, p) = p[1] * x[2] + p[2] * (-x[1])
H1(x, p) = p[2]
H01 = Poisson(H0, H1)
H001 = Poisson(H0, H01)
H101 = Poisson(H1, H01)
H001(x, p), H101(x, p)(-4.0, 0.0)See Singular control for a complete application on a real problem.
A trap to know about
Poisson is not defined on vector fields — lift them first:
julia
julia> XV = VectorField(x -> [x[2], -x[1]]);
julia> Poisson(XV, x -> x[1])
IncorrectArgument → top-level scope, REPL[2]:2
│
│ Poisson is not defined for AbstractVectorField operands
│
│ Context Poisson on AbstractVectorField
│ Hint Use ad(X, Y) for the Lie bracket of VectorFields
└─See also
Lie derivative and Lie bracket — the vector-field-side counterpart.
The
@Liemacro —{H, G}notation for this bracket.Singular control — the worked application.