04. Fastest descent with a depth limit
Descending deeper builds speed, but what happens if the track cannot go below a prescribed depth? A segment along the floor appears, changing the shape of the fastest path.
| Item | Definition |
|---|---|
| States | Horizontal position , depth , speed |
| Control | Angle from downward vertical |
| Objective | Minimize |
| Phases | One phase, 40 nodes, free final time |
| New concepts | State bounds as path constraints; a boundary arc |
Situation
Section titled “Situation”As in Example 03, a ball slides without friction under gravity. Here the endpoint is fixed at m, and a floor limits depth to 0.3 m. Without the floor, the fastest path descends below the destination, then climbs back up. We ask how the floor changes that solution. Gravity is 9.81 m/s².
Formulation
Section titled “Formulation”Dynamics
Section titled “Dynamics”Depth is positive downward. Angle points down, is horizontal, and angles above climb upward:
On the uphill segment, and the ball slows down. Energy conservation still gives .
Boundary conditions
Section titled “Boundary conditions”Terminal speed is not prescribed, but energy determines it as m/s.
Constraints
Section titled “Constraints”The depth upper bound is the floor. Bounds apply at every node and therefore act as path constraints. The other bounds keep optimization within the intended physical range.
Objective and parameters
Section titled “Objective and parameters”| Symbol | Parameter | Value |
|---|---|---|
gravity | 9.81 m/s² | |
distance | 1 m | |
final_depth | 0.2 m | |
max_depth | 0.3 m |
Initial guess
Section titled “Initial guess”For time 0 to 0.7 s, let and set
The depth bulges downward and returns to the target. Angle increases linearly from 0 to 2 rad (about 115°).
Results
Section titled “Results”

- Arrival time: 0.6242 s, slightly longer than the floorless value 0.6206 s.
- Without the floor, maximum depth would be 0.358 m; with it, depth is limited to 0.300 m.
- The path descends, follows the floor horizontally, then climbs. On the floor, angle is 90° and speed is constant.
- Final angle: 125°; final speed: 1.981 m/s.
Explanation
Section titled “Explanation”The boundary arc
Section titled “The boundary arc”The floor blocks the deepest, fastest part of the unconstrained curve. The next best choice is to spend time at the greatest allowed depth, where speed reaches m/s. A segment that remains on an active constraint, , is a boundary arc. Its control is fixed by the constraint: keeps depth constant. Cycloid segments join this arc tangentially on entry and exit.
Why the time penalty is small
Section titled “Why the time penalty is small”The floor excludes only a short part of the unconstrained path. Speed along the floor is still high, so the arrival-time increase is less than 1%.
Terminal direction
Section titled “Terminal direction”Unlike Example 03, depth is fixed at the endpoint. The ball must climb from the floor to 0.2 m, so it arrives on an uphill segment rather than horizontally.
Limits of one polynomial
Section titled “Limits of one polynomial”The rate of change of angle changes abruptly at the ends of the boundary arc. One polynomial rounds these corners. Since bounds hold only at nodes, interpolation can exceed the floor slightly, by around m. More nodes make the corners clearer.
Try it
Section titled “Try it”- Set
max_depthto 0.4. The floor lies below the unconstrained maximum depth (about 0.358 m), becomes inactive, and duration approaches 0.6206 s. - Set it to 0.25. The boundary arc becomes longer and duration rises to about 0.636 s.
- Use
solve(nodes=20)and compare the angle near the boundary-arc transitions with the 40-node result.
uv run python examples/04_constrained_descent.py