Nonlinear optimal control of the planar inverted pendulum (Autonomous Intelligent Systems, 2026)