Skip to content

Commit 60eca3a

Browse files
committed
Clarify when keywords are needed for @lie macro
- Specify that keywords are only needed when using only plain functions - When mixing with VectorField objects, keywords are inferred from VectorField - Removes ambiguity about when to specify autonomous/variable keywords
1 parent c010f47 commit 60eca3a

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

docs/src/manual-differential-geometry.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ The simplest way to compute a Hamiltonian lift is from a plain Julia function. B
3333
X(x) = [x[2], -x[1]]
3434
3535
# Compute its Hamiltonian lift
36-
HX = Lift(X)
36+
H = Lift(X)
3737
3838
# Evaluate at a point (x, p)
3939
x = [1, 2]
4040
p = [3, 4]
41-
HX(x, p)
41+
H(x, p)
4242
```
4343

4444
The result is $H(x, p) = p_1 x_2 + p_2 (-x_1) = 3 \times 2 + 4 \times (-1) = 2$.
@@ -51,10 +51,10 @@ You can also use the `OptimalControl.VectorField` type, which allows more contro
5151
using OptimalControl # hide
5252
# Wrap in VectorField (autonomous, non-variable by default)
5353
X = OptimalControl.VectorField(x -> [x[2], -x[1]])
54-
HX = Lift(X)
54+
H = Lift(X)
5555
5656
# This returns a HamiltonianLift object
57-
HX([1, 2], [3, 4])
57+
H([1, 2], [3, 4])
5858
```
5959

6060
### Non-autonomous case
@@ -65,10 +65,10 @@ For time-dependent vector fields, use `autonomous=false`:
6565
using OptimalControl # hide
6666
# Non-autonomous vector field: X(t, x) = [t*x[2], -x[1]]
6767
X(t, x) = [t * x[2], -x[1]]
68-
HX = Lift(X; autonomous=false)
68+
H = Lift(X; autonomous=false)
6969
7070
# Signature is now H(t, x, p)
71-
HX(2, [1, 2], [3, 4])
71+
H(2, [1, 2], [3, 4])
7272
```
7373

7474
### Variable case
@@ -79,10 +79,10 @@ For vector fields depending on an additional parameter $v$, use `variable=true`:
7979
using OptimalControl # hide
8080
# Variable vector field: X(x, v) = [x[2] + v, -x[1]]
8181
X(x, v) = [x[2] + v, -x[1]]
82-
HX = Lift(X; variable=true)
82+
H = Lift(X; variable=true)
8383
8484
# Signature is now H(x, p, v)
85-
HX([1, 2], [3, 4], 1)
85+
H([1, 2], [3, 4], 1)
8686
```
8787

8888
## Lie derivative
@@ -393,7 +393,7 @@ The `@Lie` macro provides a convenient syntax for computing Lie brackets (for ve
393393
- Plain Julia functions (automatically wrapped as `Hamiltonian`)
394394
- `Hamiltonian` objects
395395

396-
When using plain functions, specify `autonomous` and `variable` keywords as needed to match your function signature.
396+
When using **only plain functions** (no VectorField objects), specify `autonomous` and `variable` keywords as needed to match your function signature. If you mix plain functions with VectorField objects, the keywords are inferred from the VectorField objects.
397397

398398
### Lie brackets with VectorField
399399

0 commit comments

Comments
 (0)