Least Squares Data Fitting with Applications