changeset 11611:807cf4d67705 release-3-0-x

[3-0-0-branch @ 2008-01-11 02:39:45 by jwe]
author jwe
date Fri, 11 Jan 2008 02:39:46 +0000
parents 14142d084366
children 204d16b1d17f
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 19:28:30 2008 +0000
+++ b/doc/interpreter/nonlin.txi	Fri Jan 11 02:39: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 19:28:30 2008 +0000
+++ b/src/ChangeLog	Fri Jan 11 02:39: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.
+
 	* mex.cc (calc_single_subscript_internal): New static function.
 	(mxArray_octave_value::calc_single_subscript): Use it.
 	(mxArray_matlab::calc_single_subscript): Use it.
--- a/src/DLD-FUNCTIONS/fsolve.cc	Thu Jan 10 19:28:30 2008 +0000
+++ b/src/DLD-FUNCTIONS/fsolve.cc	Fri Jan 11 02:39: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\