## damped_system_pseudocode.txt function damped_system ( f, fp, x, xtol, ftol, itmax ) it = 0 DX = 0 alpha = 0 Begin loop it = it + 1 Set Xold to X Set DXold to DX Solve for DX: DF(X) * DX = - F(X) beta = 1.0 begin loop Set X = Xold + beta * DX if ( || F(X) || <= || F(Xold) || print it, beta, ||F(X)|| break from this damping loop if ( beta < 1.0 / 1024 ) return with failure beta = beta / 2.0 end loop Set alpha_old to alpha if ||DX_old|| is not 0, set alpha to ||DX|| / ||DX_old|| if alpha_old is not 0, set r = log ( alpha ) / log ( alpha_old ) if ||DX|| is less than xtol and |F(X)| is less than ftol, return success if it > itmax, return with failure End loop return updated X, and it