comparison doc/interpreter/nonlin.txi @ 33330:a2a202991cc7 stable

doc: link text and formatting adjustments to cset 87a54302d126 * nonlin.txi: Change link appearance from Anonymous Functions to Anonymous Function. Change spacing for result tags.
author Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
date Thu, 04 Apr 2024 22:49:38 -0400
parents 87a54302d126
children
comparison
equal deleted inserted replaced
33328:87a54302d126 33330:a2a202991cc7
195 195
196 Certain minimization operations require additional parameters be passed to 196 Certain minimization operations require additional parameters be passed to
197 the function, @code{F}, being minimized. E.g., @w{@code{F = F(x, C)}}. 197 the function, @code{F}, being minimized. E.g., @w{@code{F = F(x, C)}}.
198 Octave's minimizer functions are designed to only pass one optimization 198 Octave's minimizer functions are designed to only pass one optimization
199 variable to @code{F}, but parameter passing can be accomplished by defining 199 variable to @code{F}, but parameter passing can be accomplished by defining
200 an @ref{Anonymous Functions} that contains the necessary parameter(s). See 200 an @ref{Anonymous Functions,,Anonymous Function} that contains the necessary
201 the example below: 201 parameter(s). See the example below:
202 202
203 @example 203 @example
204 @group 204 @group
205 A = 2; B = 3; 205 A = 2; B = 3;
206 f = @@(x) sin (A*x + B); 206 f = @@(x) sin (A*x + B);
207 fminbnd (f, 0, 2) 207 fminbnd (f, 0, 2)
208 @result{} 0.8562 208 @result{} 0.8562
209 @end group 209 @end group
210 @end example 210 @end example
211 211
212 Note that anonymous functions retain the value of parameters at the time they 212 Note that anonymous functions retain the value of parameters at the time they
213 are defined. Changing a parameter value after function definition will not 213 are defined. Changing a parameter value after function definition will not
215 215
216 @example 216 @example
217 @group 217 @group
218 B = 4; 218 B = 4;
219 fminbnd (f, 0, 2) 219 fminbnd (f, 0, 2)
220 @result{} 0.8562 220 @result{} 0.8562
221 f = @@(x) sin (A*x + B); 221 f = @@(x) sin (A*x + B);
222 fminbnd (f, 0, 2) 222 fminbnd (f, 0, 2)
223 @result{} 0.3562 223 @result{} 0.3562
224 @end group 224 @end group
225 @end example 225 @end example
226 226
227 The function @code{humps} is a useful function for testing zero and 227 The function @code{humps} is a useful function for testing zero and
228 extrema finding functions. 228 extrema finding functions.