https://medium.com/@monocosmo77/understanding-nonlinear-least-squares-part2-artificial-intelligence-7ac9fc3c8236