Path: Math/Solvers
% Finds the solution to f(x) = 0 given derivative information. Uses df(x)/dx when only one root is possible. If there are multiple roots, x should be in the vicinity of the desired root. Since version 1. -------------------------------------------------------------------------- Form: [x, n] = ModNewt( f, fD, fDD, x, epsilon, nMax, varargin ) -------------------------------------------------------------------------- ------ Inputs ------ f String name of f(x), i.e. 'f' fD String name of df(x)/dx i.e. 'dfdx' fDD String name of d2f(x)/dx2 i.e. 'd2fdx2' x Initial guess epsilon Tolerance nMax Max number of iterations (can be inf) varargin Optional arguments ------- Outputs ------- x Result n Number of iterations -------------------------------------------------------------------------- References: Hornbeck, R., Numerical Methods, Quantum, 1975, pp. 69-70. --------------------------------------------------------------------------
Back to the Math Module page