separate sub for nonlinear computation