Mercurial > octave
diff scripts/optimization/fsolve.m @ 30893:e1788b1a315f
maint: Use "fcn" as preferred abbreviation for "function" in m-files.
* accumarray.m, accumdim.m, quadl.m, quadv.m, randi.m, structfun.m,
__is_function__.m, uigetfile.m, uimenu.m, uiputfile.m, doc_cache_create.m,
colorspace_conversion_input_check.m, imageIO.m, argnames.m, vectorize.m,
vectorize.m, normest1.m, inputname.m, nthargout.m, display_info_file.m,
decic.m, ode15i.m, ode15s.m, ode23.m, ode23s.m, ode45.m, odeset.m,
check_default_input.m, integrate_adaptive.m, ode_event_handler.m,
runge_kutta_23.m, runge_kutta_23s.m, runge_kutta_45_dorpri.m,
runge_kutta_interpolate.m, starting_stepsize.m, __all_opts__.m, fminbnd.m,
fminsearch.m, fminunc.m, fsolve.m, fzero.m, sqp.m, fplot.m, plotyy.m,
__bar__.m, __ezplot__.m, flat_entry.html, profexport.m, movfun.m, bicg.m,
bicgstab.m, cgs.m, eigs.m, gmres.m, pcg.m, __alltohandles__.m, __sprand__.m,
qmr.m, tfqmr.m, dump_demos.m:
Replace "func", "fun", "fn" in documentation and variable names with "fcn".
author | Rik <rik@octave.org> |
---|---|
date | Mon, 04 Apr 2022 18:14:56 -0700 |
parents | 5d3faba0342e |
children | 597f3ee61a48 |
line wrap: on
line diff
--- a/scripts/optimization/fsolve.m Mon Apr 04 11:22:26 2022 -0700 +++ b/scripts/optimization/fsolve.m Mon Apr 04 18:14:56 2022 -0700 @@ -32,7 +32,7 @@ ## @deftypefnx {} {[@var{x}, @var{fval}, @var{info}, @var{output}, @var{fjac}] =} fsolve (@dots{}) ## Solve a system of nonlinear equations defined by the function @var{fcn}. ## -## @var{fun} is a function handle, inline function, or string containing the +## @var{fcn} is a function handle, inline function, or string containing the ## name of the function to evaluate. @var{fcn} should accept a vector (array) ## defining the unknown variables, and return a vector of left-hand sides of ## the equations. Right-hand sides are defined to be zeros. In other words, @@ -152,7 +152,7 @@ ## recent vector. A short example how this can be achieved follows: ## ## @example -## function [fval, fjac] = user_func (x, optimvalues, state) +## function [fval, fjac] = user_fcn (x, optimvalues, state) ## persistent sav = [], sav0 = []; ## if (nargin == 1) ## ## evaluation call @@ -173,7 +173,7 @@ ## ## ## @dots{} ## -## fsolve (@@user_func, x0, optimset ("OutputFcn", @@user_func, @dots{})) +## fsolve (@@user_fcn, x0, optimset ("OutputFcn", @@user_fcn, @dots{})) ## @end example ## @seealso{fzero, optimset} ## @end deftypefn @@ -509,12 +509,12 @@ endfunction ## A helper function that evaluates a function and checks for bad results. -function [fx, jx] = guarded_eval (fun, x, complexeqn) +function [fx, jx] = guarded_eval (fcn, x, complexeqn) if (nargout > 1) - [fx, jx] = fun (x); + [fx, jx] = fcn (x); else - fx = fun (x); + fx = fcn (x); jx = []; endif @@ -675,7 +675,7 @@ %! assert (norm (c - c_opt, Inf) < tol); %! assert (norm (fval) < norm (noise)); -%!function y = cfun (x) +%!function y = cfcn (x) %! y(1) = (1+i)*x(1)^2 - (1-i)*x(2) - 2; %! y(2) = sqrt (x(1)*x(2)) - (1-2i)*x(3) + (3-4i); %! y(3) = x(1) * x(2) - x(3)^2 + (3+2i); @@ -685,7 +685,7 @@ %! x_opt = [-1+i, 1-i, 2+i]; %! x = [i, 1, 1+i]; %! -%! [x, f, info] = fsolve (@cfun, x, optimset ("ComplexEqn", "on")); +%! [x, f, info] = fsolve (@cfcn, x, optimset ("ComplexEqn", "on")); %! tol = 1e-5; %! assert (norm (f) < tol); %! assert (norm (x - x_opt, Inf) < tol);