WebCab Optimization
v2.6
(J2EE Edition)

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

All Superinterfaces:
Function, Remote, Serializable
All Known Subinterfaces:
Derivative

public interface UniDimensionalFunction
extends Function, Remote

This interface should be implemented by all user supplied functions that are unidimensional. Unidimensional functions are functions that depend upon only one variable. If, in addition, you want to supply a derivative you should implement Derivative instead.

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: f(x) = 3x2 + 4x + 3.

In order to provide an implementation for this function you are required to provide an implementation for the following method:

  1. getValueAtVector(double) - Returns the value of the function at a given point.

Source Code Implemention of a Function on the J2SE Platform

Here we provide the source code for the implementation of the function f(x) = 3x2 + 4x + 3, for the J2SE Platform.


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

 public class PolynomialFunction implements UniDimensionalFunction {

   //
	// The default constructor of the class.
   //
   public PolynomialFunction() throws Exception {}
	
   //
	// Returns the value of the object function at a given point.
   //
   public double getValueAt(double evaluationPoint) {
         return (3 * evaluationPoint * evaluationPoint + 2 * evaluationPoint + 3);
    }
 }

Source Code Implemention of a Function on the J2EE (EJB) Platform

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


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

 public class PolynomialFunction implements UniDimensionalFunction {

   //
	// The default constructor of the PolynomialFunction class.
   //
   public PolynomialFunction() throws Exception {}
	
   //
 	// Returns the value of the object function at a given point.
   //
   public double getValueAt(double evaluationPoint) {
         return (3 * evaluationPoint * evaluationPoint + 2 * evaluationPoint + 3);
    }
 }

See Also:
- Inherits from this interface and allows the derivative of the function be provided.

Method Summary
 double getValueAt(double evaluationPoint)
          Computes the value of the function at a given point.
 

Method Detail

getValueAt

public double getValueAt(double evaluationPoint)
                  throws InvalidUniDimensionalFunctionException,
                         Exception
Computes the value of the function at a given point.

Example Implementation of this Method

The following code implements this method for the function f(x) = 3x2 + 4x + 3:

    public double getValueAt(double evaluationPoint) {
         return (3 * evaluationPoint * evaluationPoint + 2 * evaluationPoint + 3);
    }
 

Parameters:
evaluationPoint - the value of the real variable at which is the function is evaluated.
Returns:
the value of the function at the point evaluationPoint
InvalidUniDimensionalFunctionException
Exception

WebCab Optimization
v2.6
(J2EE Edition)