# HG changeset patch # User jwe # Date 1200019246 0 # Node ID 8fb8d6985395b42de1a96e9250901c7684aa9609 # Parent 6a0d7b8159a0cb9267b0edc6c7d1e6e995c05cb7 [project @ 2008-01-11 02:40:46 by jwe] diff -r 6a0d7b8159a0 -r 8fb8d6985395 doc/interpreter/nonlin.txi --- a/doc/interpreter/nonlin.txi Thu Jan 10 22:38:26 2008 +0000 +++ b/doc/interpreter/nonlin.txi Fri Jan 11 02:40:46 2008 +0000 @@ -79,7 +79,7 @@ @code{f} defined above, @example -[x, info] = fsolve (@@f, [1; 2]) +[x, fval, info] = fsolve (@@f, [1; 2]) @end example @noindent @@ -91,6 +91,11 @@ 0.57983 2.54621 +fval = + + -5.7184e-10 + 5.5460e-10 + info = 1 @end example @@ -141,7 +146,7 @@ Using this Jacobian is done with the following code @example -[x, info] = fsolve (@{@@f, @@jacobian@}, [1; 2]); +[x, fval, info] = fsolve (@{@@f, @@jacobian@}, [1; 2]); @end example @noindent diff -r 6a0d7b8159a0 -r 8fb8d6985395 src/ChangeLog --- a/src/ChangeLog Thu Jan 10 22:38:26 2008 +0000 +++ b/src/ChangeLog Fri Jan 11 02:40:46 2008 +0000 @@ -1,5 +1,8 @@ 2008-01-10 John W. Eaton + * DLD-FUNCTIONS/fsolve.cc (Ffsolve): Doc fix. + (hybrd_info_to_fsolve_info): Swap return values for -1 and -2 inputs. + * DLD_FUNCTIONS/__gnuplot_raw__.l: Delete. * Makefile.in (DLD_XSRC): Remove it from the list. (BUILT_DISTFILES): Remove __gnuplot_raw__.cc from the list. diff -r 6a0d7b8159a0 -r 8fb8d6985395 src/DLD-FUNCTIONS/fsolve.cc --- a/src/DLD-FUNCTIONS/fsolve.cc Thu Jan 10 22:38:26 2008 +0000 +++ b/src/DLD-FUNCTIONS/fsolve.cc Fri Jan 11 02:40:46 2008 +0000 @@ -65,11 +65,10 @@ switch (info) { case -1: - info = -2; break; case 0: - info = -1; + info = -2; break; case 1: @@ -228,6 +227,24 @@ and an initial starting point @var{x0}, @code{fsolve} solves the set of\n\ equations such that @code{f(@var{x}) == 0}.\n\ \n\ +On return, @var{fval} contains the value of the function @var{fcn}\n\ +evaluated at @var{x}, and @var{info} may be one of the following values:\n\ +\n\ +@table @asis\n\ +\n\ +@item -2\n\ +Invalid input parameters.\n\ +@item -1\n\ +Error in user-supplied function.\n\ +@item 1\n\ +Relative error between two consecutive iterates is at most the\n\ +specified tolerance (see @code{fsolve_options}).\n\ +@item 3\n\ +Algorithm failed to converge.\n\ +@item 4\n\ +Limit on number of function calls reached.\n\ +@end table\n\ +\n\ If @var{fcn} is a two-element string array, or a two element cell array\n\ containing either the function name or inline or function handle. The\n\ first element names the function @math{f} described above, and the second\n\