https://medium.com/@monocosmo77/how-optimal-control-problems-are-used-in-machine-learning-part3-1b5a15282cf7