https://medium.com/@monocosmo77/how-optimal-control-problems-are-used-in-machine-learning-part6-a260996726d6