commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Cliff <>
Subject [math] proposal for FunctionOpertor interface
Date Wed, 19 Nov 2003 15:29:01 GMT
 in reference to bug #24717 - an enhancement to add a numerical deriviate 
operator, I wanted to get some feedback on the following approach

   Basically I am thinking of introducing a new interface as follows:

public interface FunctionOperator {

     * Evaluate the Function Operator for a given real single variable 
     * @param f the function which should be evaluated
     * @return the resultant function
     * @throws MathException if the function couldn't be evaluated
    public UnivariateRealFunction evaluate(UnivariateRealFunction f) 
throws MathException;


In addition I also have a class something like
public class DerivativeOperatorFactory() {
     public static DerivativeOperatorFactory newInstance() {...}

     public FunctionOperator getDefaultDerivativeOperator() {...}

     public FunctionOperator getCenteredDifferenceDerivativeOperator()

     .... // and so on for other implementations of numerical deriv's

In order to use this in client code it would look like


 UnivariateRealFunction f = new SomeUserDefinedFunction();
 FunctionOperator derivative =  

 UnivariateRealFunction g = derivative.evaluate( f );

 // to obtain the value of f'(0.0) use
 double fprime_at_0 = g.value( 0.0 );


  so f'(x) = g(x) for each value of x.

  as was mentioned in an earlier thread higher derivatives can be obtained 
by using the FunctionOperator twice.  

  any thoughts or comments on this approach?

      Matt Cliff            
      Cliff Consulting
      720.280.6324 (c)

      The label said install Windows 98 or better so I installed Linux.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message