org.apache.commons.math.analysis
Class CubicSplineFunction

java.lang.Object
  extended byorg.apache.commons.math.analysis.CubicSplineFunction
All Implemented Interfaces:
Serializable, UnivariateRealFunction

public class CubicSplineFunction
extends Object
implements UnivariateRealFunction, Serializable

Represents a cubic spline function. Spline functions map a certain interval of real numbers to real numbers. A cubic spline consists of segments of cubic functions. For this class, polynominal coefficents are used. Arguments outside of the domain cause an IllegalArgumentException.

Version:
$Revision: 1.9 $ $Date: 2003/11/19 03:28:23 $
See Also:
Serialized Form

Constructor Summary
CubicSplineFunction(double[] xval, double[][] c)
          Construct a function with the given segment delimiters and polynomial coefficients.
 
Method Summary
 double firstDerivative(double x)
          Compute the value for the first derivative of the function.
 double secondDerivative(double x)
          Compute the value for the second derivative of the function.
 double value(double x)
          Compute the value for the function.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CubicSplineFunction

public CubicSplineFunction(double[] xval,
                           double[][] c)
Construct a function with the given segment delimiters and polynomial coefficients.

Parameters:
xval - Spline segment interval delimiters
c - spline segment's polynominal coefficients
Method Detail

value

public double value(double x)
             throws MathException
Compute the value for the function.

Specified by:
value in interface UnivariateRealFunction
Parameters:
x - the point for which the function value should be computed
Returns:
the value
Throws:
MathException - if the function couldn't be computed due to missing additional data or other environmental problems.
See Also:
UnivariateRealFunction.value(double)

firstDerivative

public double firstDerivative(double x)
                       throws MathException
Compute the value for the first derivative of the function. It is recommended to provide this method only if the first derivative is analytical. Numerical derivatives may be acceptable in some cases. An implementation should throw an UnsupportedOperationException if this method is not implemented.

Parameters:
x - the point for which the first derivative should be computed
Returns:
the value
Throws:
MathException - if the derivative couldn't be computed.

secondDerivative

public double secondDerivative(double x)
                        throws MathException
Compute the value for the second derivative of the function. It is recommended to provide this method only if the second derivative is analytical. Numerical derivatives may be acceptable in some cases. An implementation should throw an UnsupportedOperationException if this method is not implemented.

Parameters:
x - the point for which the first derivative should be computed
Returns:
the value
Throws:
MathException - if the second derivative couldn't be computed.


Copyright © 2003-2004 Apache Software Foundation. All Rights Reserved.