help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fsolve function parameters


From: David Bateman
Subject: Re: fsolve function parameters
Date: Thu, 30 Aug 2007 13:49:31 +0200
User-agent: Thunderbird 1.5.0.7 (X11/20060921)

address@hidden wrote:
> On 08/30/2007 10:35 AM, David Bateman wrote:
>   
>> To fast, that should of course read
>>
>> fsolve (@(x) fun(x, P1, P2), x0, options)
>>     
>
> is that documented somewhere? - `help fsolve' gives the old behavior.
>
> G.
>
>   
What do you mean by documented. "help fsolve" states

<quote>
If FCN is a two-element string array, or a two element cell array
containing either the function name or inline or function handle.
</quote>

So it clearly states that the function passed can be an inline function
or function handle. These are fully documented in section 12.9 (or 11.9
in the CVS) of the manual. The particular form of the function handle I
used in the example is an anonymous function handle with is documented
in section 12.9.2 (or 11.9.2 in the CVS). The full text of this section
of the manual is

<quote>
12.9.2 Anonymous Functions
--------------------------

Anonymous functions are defined using the syntax

     @(ARGUMENT-LIST) EXPRESSION

Any variables that are not found in the argument list are inherited from
the enclosing scope.  Anonymous functions are useful for creating simple
unnamed functions from expressions or for wrapping calls to other
functions to adapt them for use by functions like `quad'.  For example,

     f = @(x) x.^2;
     quad (f, 0, 10)
         => 333.33

creates a simple unnamed function from the expression `x.^2' and passes
it to `quad',

     quad (@(x) sin (x), 0, pi)
         => 1.8391

wraps another function, and

     a = 1;
     b = 2;
     quad (@(x) betainc (x, a, b), 0, 0.4)
         => 1.3867

adapts a function with several parameters to the form required by
`quad'.  In this example, the values of A and B that are passed to
`betainc' are inherited from the current environment.
</quote>

So I consider that this syntax is documented. You might argue that the
documentation is not clear, but I'm not sure what we can do to make it
clearer. If you have an idea propose a patch, documentation patches in
the lead-up to Octave 3.0 are really welcome..

Regards
David

-- 
David Bateman                                address@hidden
Motorola Labs - Paris                        +33 1 69 35 48 04 (Ph) 
Parc Les Algorithmes, Commune de St Aubin    +33 6 72 01 06 33 (Mob) 
91193 Gif-Sur-Yvette FRANCE                  +33 1 69 35 77 01 (Fax) 

The information contained in this communication has been classified as: 

[x] General Business Information 
[ ] Motorola Internal Use Only 
[ ] Motorola Confidential Proprietary



reply via email to

[Prev in Thread] Current Thread [Next in Thread]