annotate doc/interpreter/nonlin.txi @ 12574:89604fa96d2f

Deprecate perror, strerror functions.
author Rik <octave@nomad.inbox5.com>
date Mon, 04 Apr 2011 13:37:13 -0700
parents 02e48856e486
children a1e386b9ef4b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11523
fd0a3ac60b0e update copyright notices
John W. Eaton <jwe@octave.org>
parents: 11406
diff changeset
1 @c Copyright (C) 1996-2011 John W. Eaton
7018
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6850
diff changeset
2 @c
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6850
diff changeset
3 @c This file is part of Octave.
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6850
diff changeset
4 @c
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6850
diff changeset
5 @c Octave is free software; you can redistribute it and/or modify it
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6850
diff changeset
6 @c under the terms of the GNU General Public License as published by the
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6850
diff changeset
7 @c Free Software Foundation; either version 3 of the License, or (at
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6850
diff changeset
8 @c your option) any later version.
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6850
diff changeset
9 @c
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6850
diff changeset
10 @c Octave is distributed in the hope that it will be useful, but WITHOUT
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6850
diff changeset
11 @c ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6850
diff changeset
12 @c FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6850
diff changeset
13 @c for more details.
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6850
diff changeset
14 @c
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6850
diff changeset
15 @c You should have received a copy of the GNU General Public License
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6850
diff changeset
16 @c along with Octave; see the file COPYING. If not, see
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6850
diff changeset
17 @c <http://www.gnu.org/licenses/>.
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
18
4167
aae05d51353c [project @ 2002-11-12 02:52:50 by jwe]
jwe
parents: 3368
diff changeset
19 @node Nonlinear Equations
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
20 @chapter Nonlinear Equations
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
21 @cindex nonlinear equations
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
22 @cindex equations, nonlinear
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
23
12521
02e48856e486 Add fminbnd, fminunc functions to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
24 @menu
02e48856e486 Add fminbnd, fminunc functions to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
25 * Solvers::
02e48856e486 Add fminbnd, fminunc functions to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
26 * Minimizers::
02e48856e486 Add fminbnd, fminunc functions to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
27 @end menu
02e48856e486 Add fminbnd, fminunc functions to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
28
02e48856e486 Add fminbnd, fminunc functions to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
29 @node Solvers
02e48856e486 Add fminbnd, fminunc functions to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
30 @section Solvers
02e48856e486 Add fminbnd, fminunc functions to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
31
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
32 Octave can solve sets of nonlinear equations of the form
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
33 @tex
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
34 $$
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
35 f (x) = 0
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
36 $$
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
37 @end tex
6850
9398f6a81bdf [project @ 2007-08-31 17:29:22 by jwe]
jwe
parents: 6778
diff changeset
38 @ifnottex
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
39
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
40 @example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
41 F (x) = 0
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
42 @end example
10828
322f43e0e170 Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents: 10668
diff changeset
43
6850
9398f6a81bdf [project @ 2007-08-31 17:29:22 by jwe]
jwe
parents: 6778
diff changeset
44 @end ifnottex
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
45
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
46 @noindent
12521
02e48856e486 Add fminbnd, fminunc functions to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
47 using the function @code{fsolve}, which is based on the @sc{minpack}
6850
9398f6a81bdf [project @ 2007-08-31 17:29:22 by jwe]
jwe
parents: 6778
diff changeset
48 subroutine @code{hybrd}. This is an iterative technique so a starting
12521
02e48856e486 Add fminbnd, fminunc functions to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
49 point must be provided. This also has the consequence that
8325
b93ac0586e4b spelling corrections
Brian Gough<bjg@network-theory.co.uk>
parents: 7359
diff changeset
50 convergence is not guaranteed even if a solution exists.
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
51
3368
a4cd1e9d9962 [project @ 1999-11-20 17:22:48 by jwe]
jwe
parents: 3294
diff changeset
52 @DOCSTRING(fsolve)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
53
12521
02e48856e486 Add fminbnd, fminunc functions to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
54 The following is a complete example. To solve the set of equations
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
55 @tex
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
56 $$
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
57 \eqalign{-2x^2 + 3xy + 4\sin(y) - 6 &= 0\cr
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
58 3x^2 - 2xy^2 + 3\cos(x) + 4 &= 0}
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
59 $$
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
60 @end tex
10668
72585f1ca7a2 Replace @ifinfo with @ifnottex.
Rik <octave@nomad.inbox5.com>
parents: 9209
diff changeset
61 @ifnottex
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
62
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
63 @example
9065
8207b833557f Cleanup documentation for arith.texi, linalg.texi, nonlin.texi
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
64 @group
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
65 -2x^2 + 3xy + 4 sin(y) = 6
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
66 3x^2 - 2xy^2 + 3 cos(x) = -4
9065
8207b833557f Cleanup documentation for arith.texi, linalg.texi, nonlin.texi
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
67 @end group
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
68 @end example
10828
322f43e0e170 Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents: 10668
diff changeset
69
10668
72585f1ca7a2 Replace @ifinfo with @ifnottex.
Rik <octave@nomad.inbox5.com>
parents: 9209
diff changeset
70 @end ifnottex
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
71
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
72 @noindent
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
73 you first need to write a function to compute the value of the given
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
74 function. For example:
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
75
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
76 @example
9065
8207b833557f Cleanup documentation for arith.texi, linalg.texi, nonlin.texi
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
77 @group
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
78 function y = f (x)
11406
a7e73f903ea6 nonlin.txi: correct docs for using Jacobian with fsolve
Tatsuro Matsuoka <tmacchant@yahoo.co.jp>
parents: 10828
diff changeset
79 y = zeros (2, 1);
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
80 y(1) = -2*x(1)^2 + 3*x(1)*x(2) + 4*sin(x(2)) - 6;
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
81 y(2) = 3*x(1)^2 - 2*x(1)*x(2)^2 + 3*cos(x(1)) + 4;
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
82 endfunction
9065
8207b833557f Cleanup documentation for arith.texi, linalg.texi, nonlin.texi
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
83 @end group
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
84 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
85
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
86 Then, call @code{fsolve} with a specified initial condition to find the
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
87 roots of the system of equations. For example, given the function
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
88 @code{f} defined above,
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
89
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
90 @example
7359
8fb8d6985395 [project @ 2008-01-11 02:40:46 by jwe]
jwe
parents: 7018
diff changeset
91 [x, fval, info] = fsolve (@@f, [1; 2])
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
92 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
93
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
94 @noindent
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
95 results in the solution
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
96
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
97 @example
9065
8207b833557f Cleanup documentation for arith.texi, linalg.texi, nonlin.texi
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
98 @group
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
99 x =
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
100
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
101 0.57983
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
102 2.54621
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
103
7359
8fb8d6985395 [project @ 2008-01-11 02:40:46 by jwe]
jwe
parents: 7018
diff changeset
104 fval =
8fb8d6985395 [project @ 2008-01-11 02:40:46 by jwe]
jwe
parents: 7018
diff changeset
105
8fb8d6985395 [project @ 2008-01-11 02:40:46 by jwe]
jwe
parents: 7018
diff changeset
106 -5.7184e-10
8fb8d6985395 [project @ 2008-01-11 02:40:46 by jwe]
jwe
parents: 7018
diff changeset
107 5.5460e-10
8fb8d6985395 [project @ 2008-01-11 02:40:46 by jwe]
jwe
parents: 7018
diff changeset
108
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
109 info = 1
9065
8207b833557f Cleanup documentation for arith.texi, linalg.texi, nonlin.texi
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
110 @end group
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
111 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
112
6850
9398f6a81bdf [project @ 2007-08-31 17:29:22 by jwe]
jwe
parents: 6778
diff changeset
113 @noindent
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
114 A value of @code{info = 1} indicates that the solution has converged.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
115
6850
9398f6a81bdf [project @ 2007-08-31 17:29:22 by jwe]
jwe
parents: 6778
diff changeset
116 When no Jacobian is supplied (as in the example above) it is approximated
9398f6a81bdf [project @ 2007-08-31 17:29:22 by jwe]
jwe
parents: 6778
diff changeset
117 numerically. This requires more function evaluations, and hence is
9398f6a81bdf [project @ 2007-08-31 17:29:22 by jwe]
jwe
parents: 6778
diff changeset
118 less efficient. In the example above we could compute the Jacobian
9398f6a81bdf [project @ 2007-08-31 17:29:22 by jwe]
jwe
parents: 6778
diff changeset
119 analytically as
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
120
6850
9398f6a81bdf [project @ 2007-08-31 17:29:22 by jwe]
jwe
parents: 6778
diff changeset
121 @iftex
9398f6a81bdf [project @ 2007-08-31 17:29:22 by jwe]
jwe
parents: 6778
diff changeset
122 @tex
9398f6a81bdf [project @ 2007-08-31 17:29:22 by jwe]
jwe
parents: 6778
diff changeset
123 $$
9398f6a81bdf [project @ 2007-08-31 17:29:22 by jwe]
jwe
parents: 6778
diff changeset
124 \left[\matrix{ {\partial f_1 \over \partial x_1} &
9398f6a81bdf [project @ 2007-08-31 17:29:22 by jwe]
jwe
parents: 6778
diff changeset
125 {\partial f_1 \over \partial x_2} \cr
9398f6a81bdf [project @ 2007-08-31 17:29:22 by jwe]
jwe
parents: 6778
diff changeset
126 {\partial f_2 \over \partial x_1} &
9398f6a81bdf [project @ 2007-08-31 17:29:22 by jwe]
jwe
parents: 6778
diff changeset
127 {\partial f_2 \over \partial x_2} \cr}\right] =
9398f6a81bdf [project @ 2007-08-31 17:29:22 by jwe]
jwe
parents: 6778
diff changeset
128 \left[\matrix{ 3 x_2 - 4 x_1 &
9398f6a81bdf [project @ 2007-08-31 17:29:22 by jwe]
jwe
parents: 6778
diff changeset
129 4 \cos(x_2) + 3 x_1 \cr
9398f6a81bdf [project @ 2007-08-31 17:29:22 by jwe]
jwe
parents: 6778
diff changeset
130 -2 x_2^2 - 3 \sin(x_1) + 6 x_1 &
9398f6a81bdf [project @ 2007-08-31 17:29:22 by jwe]
jwe
parents: 6778
diff changeset
131 -4 x_1 x_2 \cr }\right]
9398f6a81bdf [project @ 2007-08-31 17:29:22 by jwe]
jwe
parents: 6778
diff changeset
132 $$
9398f6a81bdf [project @ 2007-08-31 17:29:22 by jwe]
jwe
parents: 6778
diff changeset
133 @end tex
8828
8463d1a2e544 Doc fixes.
Brian Gough <bjg@network-theory.co.uk>
parents: 8654
diff changeset
134 and compute it with the following Octave function
6850
9398f6a81bdf [project @ 2007-08-31 17:29:22 by jwe]
jwe
parents: 6778
diff changeset
135 @end iftex
9398f6a81bdf [project @ 2007-08-31 17:29:22 by jwe]
jwe
parents: 6778
diff changeset
136
9398f6a81bdf [project @ 2007-08-31 17:29:22 by jwe]
jwe
parents: 6778
diff changeset
137 @example
9065
8207b833557f Cleanup documentation for arith.texi, linalg.texi, nonlin.texi
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
138 @group
11406
a7e73f903ea6 nonlin.txi: correct docs for using Jacobian with fsolve
Tatsuro Matsuoka <tmacchant@yahoo.co.jp>
parents: 10828
diff changeset
139 function [y, jac] = f (x)
a7e73f903ea6 nonlin.txi: correct docs for using Jacobian with fsolve
Tatsuro Matsuoka <tmacchant@yahoo.co.jp>
parents: 10828
diff changeset
140 y = zeros (2, 1);
a7e73f903ea6 nonlin.txi: correct docs for using Jacobian with fsolve
Tatsuro Matsuoka <tmacchant@yahoo.co.jp>
parents: 10828
diff changeset
141 y(1) = -2*x(1)^2 + 3*x(1)*x(2) + 4*sin(x(2)) - 6;
a7e73f903ea6 nonlin.txi: correct docs for using Jacobian with fsolve
Tatsuro Matsuoka <tmacchant@yahoo.co.jp>
parents: 10828
diff changeset
142 y(2) = 3*x(1)^2 - 2*x(1)*x(2)^2 + 3*cos(x(1)) + 4;
a7e73f903ea6 nonlin.txi: correct docs for using Jacobian with fsolve
Tatsuro Matsuoka <tmacchant@yahoo.co.jp>
parents: 10828
diff changeset
143 if (nargout == 2)
a7e73f903ea6 nonlin.txi: correct docs for using Jacobian with fsolve
Tatsuro Matsuoka <tmacchant@yahoo.co.jp>
parents: 10828
diff changeset
144 jac = zeros (2, 2);
a7e73f903ea6 nonlin.txi: correct docs for using Jacobian with fsolve
Tatsuro Matsuoka <tmacchant@yahoo.co.jp>
parents: 10828
diff changeset
145 jac(1,1) = 3*x(2) - 4*x(1);
a7e73f903ea6 nonlin.txi: correct docs for using Jacobian with fsolve
Tatsuro Matsuoka <tmacchant@yahoo.co.jp>
parents: 10828
diff changeset
146 jac(1,2) = 4*cos(x(2)) + 3*x(1);
a7e73f903ea6 nonlin.txi: correct docs for using Jacobian with fsolve
Tatsuro Matsuoka <tmacchant@yahoo.co.jp>
parents: 10828
diff changeset
147 jac(2,1) = -2*x(2)^2 - 3*sin(x(1)) + 6*x(1);
a7e73f903ea6 nonlin.txi: correct docs for using Jacobian with fsolve
Tatsuro Matsuoka <tmacchant@yahoo.co.jp>
parents: 10828
diff changeset
148 jac(2,2) = -4*x(1)*x(2);
a7e73f903ea6 nonlin.txi: correct docs for using Jacobian with fsolve
Tatsuro Matsuoka <tmacchant@yahoo.co.jp>
parents: 10828
diff changeset
149 endif
6850
9398f6a81bdf [project @ 2007-08-31 17:29:22 by jwe]
jwe
parents: 6778
diff changeset
150 endfunction
9065
8207b833557f Cleanup documentation for arith.texi, linalg.texi, nonlin.texi
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
151 @end group
6850
9398f6a81bdf [project @ 2007-08-31 17:29:22 by jwe]
jwe
parents: 6778
diff changeset
152 @end example
9398f6a81bdf [project @ 2007-08-31 17:29:22 by jwe]
jwe
parents: 6778
diff changeset
153
9398f6a81bdf [project @ 2007-08-31 17:29:22 by jwe]
jwe
parents: 6778
diff changeset
154 @noindent
8828
8463d1a2e544 Doc fixes.
Brian Gough <bjg@network-theory.co.uk>
parents: 8654
diff changeset
155 The Jacobian can then be used with the following call to @code{fsolve}:
6850
9398f6a81bdf [project @ 2007-08-31 17:29:22 by jwe]
jwe
parents: 6778
diff changeset
156
9398f6a81bdf [project @ 2007-08-31 17:29:22 by jwe]
jwe
parents: 6778
diff changeset
157 @example
11406
a7e73f903ea6 nonlin.txi: correct docs for using Jacobian with fsolve
Tatsuro Matsuoka <tmacchant@yahoo.co.jp>
parents: 10828
diff changeset
158 [x, fval, info] = fsolve (@@f, [1; 2], optimset ("jacobian", "on"));
6850
9398f6a81bdf [project @ 2007-08-31 17:29:22 by jwe]
jwe
parents: 6778
diff changeset
159 @end example
9398f6a81bdf [project @ 2007-08-31 17:29:22 by jwe]
jwe
parents: 6778
diff changeset
160
9398f6a81bdf [project @ 2007-08-31 17:29:22 by jwe]
jwe
parents: 6778
diff changeset
161 @noindent
9398f6a81bdf [project @ 2007-08-31 17:29:22 by jwe]
jwe
parents: 6778
diff changeset
162 which gives the same solution as before.
9398f6a81bdf [project @ 2007-08-31 17:29:22 by jwe]
jwe
parents: 6778
diff changeset
163
8515
ec2715c76039 fzero.m, fsolve.m: additional doc fixes
John W. Eaton <jwe@octave.org>
parents: 8325
diff changeset
164 @DOCSTRING(fzero)
12521
02e48856e486 Add fminbnd, fminunc functions to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
165
02e48856e486 Add fminbnd, fminunc functions to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
166 @node Minimizers
02e48856e486 Add fminbnd, fminunc functions to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
167 @section Minimizers
02e48856e486 Add fminbnd, fminunc functions to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
168 @cindex local minimum
02e48856e486 Add fminbnd, fminunc functions to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
169 @cindex finding minimums
02e48856e486 Add fminbnd, fminunc functions to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
170
02e48856e486 Add fminbnd, fminunc functions to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
171 Often it is useful to find the minimum value of a function rather than just
02e48856e486 Add fminbnd, fminunc functions to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
172 the zeroes where it crosses the x-axis. @code{fminbnd} is designed for the
02e48856e486 Add fminbnd, fminunc functions to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
173 simpler, but very common, case of a univariate function where the interval
02e48856e486 Add fminbnd, fminunc functions to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
174 to search is bounded. For unbounded minimization of a function with
02e48856e486 Add fminbnd, fminunc functions to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
175 potentially many variables use @code{fminunc}. @xref{Optimization}, for
02e48856e486 Add fminbnd, fminunc functions to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
176 minimzation with the presence of constraint functions. Note that searches
02e48856e486 Add fminbnd, fminunc functions to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
177 can be made for maxima by simply inverting the objective function
02e48856e486 Add fminbnd, fminunc functions to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
178 @tex
02e48856e486 Add fminbnd, fminunc functions to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
179 ($F_{max} = -F_{min}$).
02e48856e486 Add fminbnd, fminunc functions to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
180 @end tex
02e48856e486 Add fminbnd, fminunc functions to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
181 @ifnottex
02e48856e486 Add fminbnd, fminunc functions to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
182 (@code{Fto_max = -Fto_min}).
02e48856e486 Add fminbnd, fminunc functions to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
183 @end ifnottex
02e48856e486 Add fminbnd, fminunc functions to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
184
02e48856e486 Add fminbnd, fminunc functions to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
185 @DOCSTRING(fminbnd)
02e48856e486 Add fminbnd, fminunc functions to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
186
02e48856e486 Add fminbnd, fminunc functions to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
187 @DOCSTRING(fminunc)
02e48856e486 Add fminbnd, fminunc functions to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
188