diff scripts/optimization/fminbnd.m @ 22765:01aae08a0105

maint: Rename variables to match documentation in m-files. * fminbnd.m, javaclasspath.m, ls_command.m, isprop.m, roots.m, bicg.m, cgs.m, qmr.m, dump_demos.m: Rename variables in function to match documentation. * normest1.m, AbsRel_norm.m, colstyle.m, frame2im.m, rotate.m: Rename variables in documentation to match function. * recycle.m: Rename variable 'state' to 'val' in documentation, and then throughout code. * untabify.m: Rename variable 'dblank' to 'deblank_arg'. * speed.m: Add comment about why variable names can't match documentation.
author Rik <rik@octave.org>
date Mon, 14 Nov 2016 14:55:41 -0800
parents 3a2b891d0b33
children ef4d915df748
line wrap: on
line diff
--- a/scripts/optimization/fminbnd.m	Mon Nov 14 12:53:43 2016 -0800
+++ b/scripts/optimization/fminbnd.m	Mon Nov 14 14:55:41 2016 -0800
@@ -60,7 +60,7 @@
 ## PKG_ADD: ## Discard result to avoid polluting workspace with ans at startup.
 ## PKG_ADD: [~] = __all_opts__ ("fminbnd");
 
-function [x, fval, info, output] = fminbnd (fun, xmin, xmax, options = struct ())
+function [x, fval, info, output] = fminbnd (fun, a, b, options = struct ())
 
   ## Get default options if requested.
   if (nargin == 1 && ischar (fun) && strcmp (fun, 'defaults'))
@@ -73,7 +73,7 @@
     print_usage ();
   endif
 
-  if (xmin > xmax)
+  if (a > b)
     error ("Octave:invalid-input-arg",
            "fminbnd: the lower bound cannot be greater than the upper one");
   endif
@@ -100,14 +100,13 @@
   nfev = 0;
 
   c = 0.5*(3 - sqrt (5));
-  a = xmin; b = xmax;
   v = a + c*(b-a);
   w = x = v;
   e = 0;
   fv = fw = fval = fun (x);
   nfev += 1;
 
-  if (isa (xmin, "single") || isa (xmax, "single") || isa (fval, "single"))
+  if (isa (a, "single") || isa (b, "single") || isa (fval, "single"))
     sqrteps = eps ("single");
   else
     sqrteps = eps ("double");