commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Axel <axel...@gmail.com>
Subject Re: [Math] Package for "UnivariateRealFunction"s
Date Wed, 27 Oct 2010 16:21:54 GMT
On Wed, Oct 27, 2010 at 12:46 PM, Gilles Sadowski
<gilles@harfang.homelinux.org> wrote:
> Hi.
>
> What do you think of creating a "function" package that would contain all
> the usual functions as classes implementing the "UnivariateRealFunction"
> interface?  I.e. for example:
> ---CUT---
> package org.apache.commons.math.function;
>
> import org.apache.commons.math.util.FastMath;
>
> public class Cos implements UnivariateRealFunction {
>    public double value(double x) {
>        return FastMath.cos(x);
>    }
> }
Where is the big difference/advantage instead of using a static import
like this:

import static org.apache.commons.math.analysis.ComposableFunction.*

and using COS from there?

Now you can create composed functions like this:

UnivariateRealFunction f = COS.of(SIN)

-- 
Axel Kramer
http://code.google.com/p/symja/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message