WebCab Optimization
v2.6
(J2EE Edition)

com.webcab.ejb.math.optimization.unidimensional
Interface Derivative

All Superinterfaces:
Function, Remote, Serializable, UniDimensionalFunction

public interface Derivative
extends UniDimensionalFunction

This interface should be implemented by all user-defined functions that are unidimensional and have a derivative. Unidimensional functions are functions that have only one variable.

Source Code Examples

With this section we provide source code examples which illustrate explicitly how a uni-dimensional function is implemented. In particular, we provide the source code for the implementation of a polynomial.

Here we provide the definition of the object function: f(x) = 3x^2 + 4x + 3 which is a linear function.

In order to provide an implementation for this interface you are required to provide an implementation for the following methods:

  1. getValueAtVector(double[]) - Returns the value of the function f, at a given point.
  2. getDerivativeAt(double[]) - Returns the value of the derivative of the function f, at a given point.

Source Code Implemention on the Java (J2SE) Platform

Here we provide the source code for the implementation of the function f(x) = 3x^2 + 4x + 3, on the Java Platform.


 import webcab.lib.math.optimization.unidimensional.*;

 public class PolynomialFunction implements UniDimensionalFunction, Derivative {

	public PolynomialFunction() throws Exception {}


   // Returns the value of the objective function at a given point.
   //
   public double getValueAt(double evaluationPoint) {
         return (3*evaluationPoint*evaluationPoint + 2*evaluationPoint + 3);
    }

    // Returns the value of the derivative of the objective function
    // evaluated at a given point.
    //
    public double getDerivativeAt(double evaluationPoint) {
         return (6*evaluationPoint + 4);
    }

Source Code Implemention on the Java (J2EE) Platform

Here we provide the source code for the implementation of the function f(x) = 3x^2 + 4x + 3, on the EJB (J2EE) Platform.

 import com.webcab.ejb.math.optimization.unidimensional.*;
 import java.rmi.*;
 import javax.rmi.*;
 import javax.naming.*;
 import javax.ejb.*;

 public class PolynomialFunction implements UniDimensionalFunction, Derivative {

	public PolynomialFunction() throws Exception {}

   // Returns the value of the objective function at a given point.
   //
   public double getValueAt(double evaluationPoint) {
         return (3*evaluationPoint*evaluationPoint + 2*evaluationPoint + 3);
    }

    // Returns the value of the derivative of the objective function
    // evaluated at a given point.
    //
    public double getDerivativeAt(double evaluationPoint) {
         return (6*evaluationPoint + 4);
    }
 

See Also:
This interface inherits from this interface.

Method Summary
 double getDerivativeAt(double x)
          Computes the derivative of the function at the point x.
 
Methods inherited from interface com.webcab.ejb.math.optimization.unidimensional.UniDimensionalFunction
getValueAt
 

Method Detail

getDerivativeAt

public double getDerivativeAt(double x)
                       throws InvalidUniDimensionalFunctionException,
                              Exception
Computes the derivative of the function at the point x.

Parameters:
x - the value of the variable of the function for which the derivative is evaluated.
Returns:
the value of the derivative
Throws:
RemoteException
InvalidUniDimensionalFunctionException
Exception

WebCab Optimization
v2.6
(J2EE Edition)