Package org.apache.commons.math.analysis.polynomials

Examples of org.apache.commons.math.analysis.polynomials.PolynomialFunctionLagrangeForm


     * @return a function which interpolates the data set
     * @throws MathException if arguments are invalid
     */
    public PolynomialFunctionLagrangeForm interpolate(double x[], double y[])
        throws MathException {
        return new PolynomialFunctionLagrangeForm(x, y);
    }
View Full Code Here


     * @return a function which interpolates the data set
     * @throws MathException if arguments are invalid
     */
    public PolynomialFunctionLagrangeForm interpolate(double x[], double y[])
        throws MathException {
        return new PolynomialFunctionLagrangeForm(x, y);
    }
View Full Code Here

      throw new MathException("Could not get upper bound: index " + upperBound + " must be less than or equal to " + (n + 1));
    }
    final double[] x = Arrays.copyOfRange(keys, lowerBound, upperBound);
    final double[] y = Arrays.copyOfRange(values, lowerBound, upperBound);
    try {
      final PolynomialFunctionLagrangeForm lagrange = _interpolator.interpolate(x, y);
      return CommonsMathWrapper.unwrap(lagrange).evaluate(value);
    } catch (final org.apache.commons.math.MathException e) {
      throw new MathException(e);
    }
  }
View Full Code Here

    final double[] y = new double[n];
    for (int i = 0; i < n; i++) {
      x[i] = i;
      y[i] = OG_POLYNOMIAL.evaluate(x[i]);
    }
    final Function1D<Double, Double> unwrapped = CommonsMathWrapper.unwrap(new PolynomialFunctionLagrangeForm(x, y));
    for (int i = 0; i < 100; i++) {
      assertEquals(unwrapped.evaluate(i + 0.5), OG_POLYNOMIAL.evaluate(i + 0.5), 1e-9);
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.commons.math.analysis.polynomials.PolynomialFunctionLagrangeForm

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.