https://medium.com/@monocosmo77/understanding-nonlinear-least-squares-part1-artificial-intelligence-f7704ab5acf