comparison scripts/optimization/fsolve.m @ 8513:352d3245d4c1

fsolve.m: doc fix
author John W. Eaton <jwe@octave.org>
date Wed, 14 Jan 2009 15:47:37 -0500
parents cadc73247d65
children 39867b4aca52
comparison
equal deleted inserted replaced
8512:137d6c94212f 8513:352d3245d4c1
17 ## <http://www.gnu.org/licenses/>. 17 ## <http://www.gnu.org/licenses/>.
18 ## 18 ##
19 ## Author: Jaroslav Hajek <highegg@gmail.com> 19 ## Author: Jaroslav Hajek <highegg@gmail.com>
20 20
21 ## -*- texinfo -*- 21 ## -*- texinfo -*-
22 ## @deftypefn{Function File} {} fsolve(@var{fcn}, @var{x0}, @var{options}) 22 ## @deftypefn{Function File} {} fsolve (@var{fcn}, @var{x0}, @var{options})
23 ## @deftypefnx{Function File} {[@var{x}, @var{fvec}, @var{info}, @var{output}, @var{fjac}]} = fsolve (@var{fcn}, @dots{}) 23 ## @deftypefnx{Function File} {[@var{x}, @var{fvec}, @var{info}, @var{output}, @var{fjac}]} = fsolve (@var{fcn}, @dots{})
24 ## Solves a system of nonlinear equations defined by the function @var{fcn}. 24 ## Solve a system of nonlinear equations defined by the function @var{fcn}.
25 ## @var{fcn} should accepts a vector (array) defining the unknown variables, 25 ## @var{fcn} should accepts a vector (array) defining the unknown variables,
26 ## and return a vector of left-hand sides of the equations. Right-hand sides 26 ## and return a vector of left-hand sides of the equations. Right-hand sides
27 ## are defined to be zeros. 27 ## are defined to be zeros.
28 ## In other words, this function attempts to determine a vector @var{X} such 28 ## In other words, this function attempts to determine a vector @var{X} such
29 ## that @code{@var{fcn}(@var{X})} gives (approximately) all zeros. 29 ## that @code{@var{fcn}(@var{X})} gives (approximately) all zeros.
30 ## @var{x0} determines a starting guess. The shape of @var{x0} is preserved 30 ## @var{x0} determines a starting guess. The shape of @var{x0} is preserved
31 ## in all calls to @var{fcn}, but otherwise it is treated as a column vector. 31 ## in all calls to @var{fcn}, but otherwise it is treated as a column vector.
32 ## @var{options} is a structure specifying additional options. Currently, fsolve 32 ## @var{options} is a structure specifying additional options. Currently, fsolve
33 ## recognizes these options: FunValCheck, OutputFcn, TolX, TolFun, MaxIter, 33 ## recognizes these options: @code{"FunValCheck"}, @code{"OutputFcn"},
34 ## MaxFunEvals and Jacobian. 34 ## @code{"TolX"}, @code{"TolFun"}, @code{"MaxIter"},
35 ## 35 ## @code{"MaxFunEvals"} and @code{"Jacobian"}.
36 ## If Jacobian is 'on', it specifies that @var{fcn}, called with 2 output arguments, 36 ##
37 ## also returns the Jacobian matrix of right-hand sides at the requested point. 37 ## If @code{"Jacobian"} is @code{"on"}, it specifies that @var{fcn},
38 ## TolX specifies the termination tolerance in the unknown variables, while 38 ## called with 2 output arguments, also returns the Jacobian matrix
39 ## TolFun is a tolerance for equations. Default is @code{1e1*eps} 39 ## of right-hand sides at the requested point. @code{"TolX"} specifies
40 ## for TolX and @code{1e2*eps} for TolFun. 40 ## the termination tolerance in the unknown variables, while
41 ## @code{"TolFun"} is a tolerance for equations. Default is @code{1e1*eps}
42 ## for @code{"TolX"} and @code{1e2*eps} for @code{"TolFun"}.
41 ## For description of the other options, see @code{optimset}. 43 ## For description of the other options, see @code{optimset}.
42 ## 44 ##
43 ## On return, @var{fval} contains the value of the function @var{fcn} 45 ## On return, @var{fval} contains the value of the function @var{fcn}
44 ## evaluated at @var{x}, and @var{info} may be one of the following values: 46 ## evaluated at @var{x}, and @var{info} may be one of the following values:
45 ## 47 ##
57 ## The trust region radius became excessively small. 59 ## The trust region radius became excessively small.
58 ## @end table 60 ## @end table
59 ## 61 ##
60 ## Note: If you only have a single nonlinear equation of one variable, using 62 ## Note: If you only have a single nonlinear equation of one variable, using
61 ## @code{fzero} is usually a much better idea. 63 ## @code{fzero} is usually a much better idea.
62 ## @seealso{fzero,optimset} 64 ## @seealso{fzero, optimset}
63 ## @end deftypefn 65 ## @end deftypefn
64 66
65 function [x, fvec, info, output, fjac] = fsolve (fcn, x0, options) 67 function [x, fvec, info, output, fjac] = fsolve (fcn, x0, options)
66 68
67 if (nargin < 3) 69 if (nargin < 3)