Text this: Dynamic programming and optimal trajectories for quadratic variational processes /