help-octave
[Top][All Lists]
Advanced

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

Re: Bi variate to mono variate functions


From: John W. Eaton
Subject: Re: Bi variate to mono variate functions
Date: Thu, 30 Mar 2006 08:37:37 -0500

On 29-Mar-2006, David Bateman wrote:

| There is currently no way to do this, though funnily I just implemented
| it with the attached patch I'm working on in another thread about
| importing octave-forge changes into octave. So if you want to rebuild
| octave the you have the patch :-)

Currently, the inputs to quad are

  quad (f, a, b, tol, sing)

with tol and sing optional, and sing not even allowed if the integral
is indefinite.  If you add parameters following this, you will
force users who want to use parameters to specify tol and sing, so
there needs to be another way to tell quad to use default values for
these parameters.  Perhaps [] as placeholders could mean "use the
default value".

But in any case, this is apparently not compatible with Matlab now.
(I'm not sure, but I thought Matlab's quad function used to allow
optional additional parameters to quad; if so, then that has changed.)

So I'm not sure that we need this feature now.  Instead, perhaps we
should make it possible to use an anonymous function to pass
parameters in a Matlab-compatible way.  For example, Octave (2.9.x)
can do the following:

  function f (x, p)
    ...
  endfunction

  quad (@(x) f(x, 1), a, b)

but not

  p = ...;

  quad (@(x) f(x, p), a, b)

To make the latter case work may require some significant changes to
Octave as it means anonymous functions must be able to find values for
unbound parameters in the context where they are defined (and we first
need to understand precisely what the rules are for looking up these
values -- is it done when the function is defined, or when it is used?).

I think this discussion should be moved to the maintainers list.

jwe



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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