changeset 7359:8fb8d6985395

[project @ 2008-01-11 02:40:46 by jwe]
author jwe
date Fri, 11 Jan 2008 02:40:46 +0000
parents 6a0d7b8159a0
children 1e716cb4b2a3
files doc/interpreter/nonlin.txi src/ChangeLog src/DLD-FUNCTIONS/fsolve.cc
diffstat 3 files changed, 29 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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
--- 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  <jwe@octave.org>
 
+	* 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.
--- 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\