first ver. of nonlinear solver (not tested)