http://mathinfinity.net.ru/articles/all_math/nemeric_method/function_approxination/methoa-naimenshih-kvadratov