Action, Legendre and quadratic declarations
Action and residual
Open Study → Lagrangian action and residual…. Path model or source changes the fields and the start command. A positive Mass (kg) is common to all. The stiffness is in N/m where required.
| Path | Inputs and goal |
|---|---|
| Straight-line reference | Set mass and stiffness. Evaluate path analyses the reference q(t)=1+2t m, t from 0 to 1 s. |
| Dataset trajectory | Choose Source Dataset, Time variable and Displacement variable. From 3 to 512 ordered time measurements are needed, with compatible units. Evaluate path estimates velocity, action and residual on the given path. With the straight-line CSV (ZIP), m=2 kg and k=0 N/m, the test gave 4 J·s and residual 0 N. |
| Solve initial-value problem | Fill in Initial position (m), Initial velocity (m/s), Duration from 0 s (s), Stiffness (N/m) and Output samples (3–512). Solve and review integrates m·q″=−k·q with relative tolerance 10⁻⁹ and absolute tolerance 10⁻¹¹ in the units of position and velocity. |
| Fixed-endpoint free particle | Fill in Initial position (m), Final position (m), Duration from 0 s (s) and Velocity intervals (2–511). For an interior knot enter both Interior knot index (optional) and Position at interior knot (m). The index is inside the grid. Solve and review looks for the path of the free particle with fixed-endpoint constraints. |
If the summary is not visible after changing path, enlarge the dialog vertically (224). Read the action in J·s, the momentum in kg·m/s and the residual in N. Sampling and finite differences affect the residual most. After a valid review enter a New Dataset ID and Graph title for Publish Graph.
The test with Straight-line reference, m=2 kg and k=0 N/m gives action 4 J·s and interior residual 0 N. The same reference value is expected for Fixed-endpoint free particle from 1 to 3 m in 1 s with m=2 kg. In the standard P012 profile the fixed-endpoint solver branch stops with package optim is not installed. The straight-line reference lets you evaluate the assigned trajectory with the same conditions. With Octave optim available in the isolated profile (215), Fixed-endpoint free particle returns four intervals at 2 m/s and action 4 J·s.





Legendre transform at one state
Open Legendre transform at one state…. Each row identifies an independent coordinate at the same instant. Fill in Label, q (m), v (m/s), m (kg) and k (N/m). Add coordinate adds a row and Remove last removes the last one when at least one remains. A positive mass makes the transformation invertible; the stiffness can have either sign. If the window opens at 200×200 and leaves the buttons out of view (217), widen it and increase its height until Evaluate state and the summary are visible.
With q=1 m, v=4 m/s, m=2 kg, k=3 N/m, Evaluate state gave p=8 kg·m/s and H=17.5 J. The energy of this case is ½mv² + ½kq². Store state Dataset uses New Dataset ID and Dataset title. The test created math_guide_legendre_state. In Dataset look for the ID and the position, velocity and momentum columns. The transformation concerns the state set. To discuss conservation along the motion you need a trajectory.



Quadratic declaration
Open Declare quadratic Lagrangian or Hamiltonian…. Function chooses Lagrangian L(q,v) or Hamiltonian H(q,p). In Coordinate label use 1 to 32 ASCII characters starting with a letter. Fill in a positive Mass (kg) and Stiffness (kg/s²; N/m) with the desired sign. In the first case the kinetic variable is the velocity, in the second the momentum. Review Function prepares the representation. Store Function requires a free ID and a title. The result, if created, reopens as a Mathematical Function. On P012 both modes reached FAILED during Review Function in the diagnostic profile and did not enable Store Function (220, update of 214). Legendre at a single state and the trajectory evaluations remain separate, tested paths.
