Skip to content

Lift ​

Given a vector field   , its Hamiltonian lift is the function     defined by

It is an algebraic construction: no derivative is computed.

julia
using OptimalControl
using OrdinaryDiffEqTsit5

From a plain function ​

julia
X(x) = [x[2], -x[1]]
H = Lift(X)

x, p = [1.0, 2.0], [3.0, 4.0]
H(x, p)   # 3 × 2 + 4 × (-1)
2.0

The lift of a plain function is a function, not a Hamiltonian:

julia
H isa Function, H isa AbstractHamiltonian
(true, false)

From a typed vector field ​

The lift of a VectorField is a Hamiltonian, with the same dependence on time and on the variable as the vector field:

julia
XV = VectorField(x -> [x[2], -x[1]])
HV = Lift(XV)
HV isa AbstractHamiltonian, HV(x, p)
(true, 2.0)

Time and variable ​

For a vector field , pass is_autonomous=false, and the lift is called as . With   ,       :

julia
Ht = Lift((t, x) -> [t * x[2], -x[1]]; is_autonomous=false)
Ht(2.0, x, p)
8.0

For a vector field , pass is_variable=true, and the lift is called as . With    ,       :

julia
Hv = Lift((x, v) -> [x[2] + v, -x[1]]; is_variable=true)
Hv(x, p, 1.0)
5.0
You liftYou getCalled as
a function Xa function (OptimalControl.LiftedHamiltonianFunction)H(x, p), H(t, x, p), H(x, p, v) or H(t, x, p, v), from the keywords
a VectorFielda Hamiltonianthe same, from the traits of the vector field

The flow of a lift ​

The Hamiltonian flow of integrates   together with the adjoint equation   . For   , this gives   and  . A Hamiltonian is needed to build the flow (see From Hamiltonians), so lift a VectorField, or wrap the lift of a function in Hamiltonian:

julia
f = Flow(Lift(VectorField(x -> -x)))
xf, pf = f(0, x, p, 1)
([0.3678794412274374, 0.7357588824548748], [8.154845485865408, 10.873127314487212])

The lift is also the bridge between the two brackets:   (see The bridge identity).

A Hamiltonian vector field cannot be lifted ​

A HamiltonianVectorField already lives on the cotangent space, so Lift rejects it. The message names ad instead of Lift (CTLie#41):

julia
julia> Lift(HamiltonianVectorField((x, p) -> (p, -x)))
NotImplemented → top-level scope, REPL[1]:2
│
│  ad on AbstractHamiltonianVectorField is not implemented (signature is (x,p), not (x))
│
│  Context  ad on AbstractVectorField
│  Hint     Use ad on a plain VectorField
└─

See also ​