Example usage for org.apache.commons.math.analysis.polynomials PolynomialFunctionLagrangeForm value

List of usage examples for org.apache.commons.math.analysis.polynomials PolynomialFunctionLagrangeForm value

Introduction

In this page you can find the example usage for org.apache.commons.math.analysis.polynomials PolynomialFunctionLagrangeForm value.

Prototype

public double value(double z) throws FunctionEvaluationException 

Source Link

Usage

From source file:com.opengamma.analytics.math.util.wrapper.CommonsMathWrapper.java

/**
 * @param lagrange A Commons polynomial in Lagrange form, not null
 * @return An OG 1-D function mapping doubles to doubles
 *//*from   w w  w  .j  a va2s  .  c om*/
public static Function1D<Double, Double> unwrap(final PolynomialFunctionLagrangeForm lagrange) {
    Validate.notNull(lagrange);
    return new Function1D<Double, Double>() {

        @Override
        public Double evaluate(final Double x) {
            try {
                return lagrange.value(x);
            } catch (final org.apache.commons.math.MathException e) {
                throw new MathException(e);
            }
        }

    };
}