help-octave
[Top][All Lists]
Advanced

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

Function names in feval


From: Dirk Laurie
Subject: Function names in feval
Date: Wed, 22 Mar 2000 10:17:09 +0200 (SAST)

In the following Octave code (2.0.14):

  function y=integ(f,a,b,n)
  h=(b-a)/n; x=a+h*(0.5:n);
  y=h*sum(feval(f,x));
  endfunction

the string 'f' may not contain the name of any local variable.
I.e. if I have coded

  function y=f(x)
  y=exp(sin(x));
  endfunction

it is illegal to ask for

  integ('f', 0, 2*pi, 16)

This means I have to do one of the following:

(a) use local variables with names like f_, h_ etc and tell
    my user not to use such names.  Problem: if his routine,
    in turn, has a function argument, he has to think up
    another convention for his own local variables, etc. 

(b) make a list of all local variables and tell my user those
    are illegal.

Neither is very satisfactory.  However, this must be a common
problem which must by now have a satisfactory solution.

I'm looking for one of the following answers:

(a) "Set THE_RIGHT_GLOBAL_VARIABLE to 1 and it will ignore
     local variables for feval."
(b) "Install 2.0.16, in which this problem has been fixed."
(c) "This is a standard situation, which must be handled as 
     follows..."

Dirk Laurie



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

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



reply via email to

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