help-octave
[Top][All Lists]
Advanced

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

Re: newbie: function of function of function ...


From: Dot Deb
Subject: Re: newbie: function of function of function ...
Date: Fri, 28 Sep 2012 17:09:29 +0200

On Thu, Sep 27, 2012 at 11:22 PM, Juan Pablo Carbajal
<address@hidden> wrote:
> If you want to use function handles, the operation * and log are not
> defined for them so it is not possible. If you really want to improve
> GNU Octave, please ask the developers (in IRC or here) what are the
> chances to overload the operator and the function log for function
> handles. For example
>
> function f_handle2 = log(f_handle)
>   f_handle2 = @(x) log (f_handle(x));
> end
>
> This may be highly non efficient!

What you are saying is that this is one of the possible solution but
it is not efficient, right?
More efficient solutions would require the possibility to overload the
operators "*" and "log" (and similar, I guess).
When I will be more familiar with octave, I will send developers the
request.Juan Pablo Carbajal <address@hidden>


> Another possibility is that, if you have defined the function in a
> file, that you create the handle inside the function entropy
> function retval = entropy( f_txt )
>   eval(sprintf("f = @(x) -%s(x) .* log( %s(x) );",f_txt,f_txt))
>   quadcc( f, -Inf, +Inf)
> end
>
> This doesn't look to elegant but is a solution.

In you opinion, is this solution more efficient or it shares the same problem?

In any case, thank you for the info: I'm learning and anything can be useful.

Alberto


reply via email to

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