Solves nonlinear equations and nonlinear least squares problems