ExponentialExtrapolator1D extends Interpolator1D { @Override public Double interpolate(final Interpolator1DDataBundle data, final Double value) { Validate.notNull(data, "data"); Validate.notNull(value, "value"); if (value < data.firstKey()) { return leftExtrapolate(data, value); } else if (value > data.lastKey()) { return rightExtrapolate(data, value); } throw new IllegalArgumentException("Value " + value + " was within data range"); }  @Override Interpolator1DDataBundle getDataBundle(final double[] x, final double[] y); @Override Interpolator1DDataBundle getDataBundleFromSortedArrays(final double[] x, final double[] y); @Override Double interpolate(final Interpolator1DDataBundle data, final Double value); @Override double firstDerivative(final Interpolator1DDataBundle data, final Double value); @Override double[] getNodeSensitivitiesForValue(final Interpolator1DDataBundle data, final Double value);  }
@Test public void value() { double mLeft = Math.log(Y_DATA[0]) / X_DATA[0]; double mRight = Math.log(Y_DATA[X_DATA.length - 1]) / X_DATA[X_DATA.length - 1]; double value; value = 0.0; assertEquals("ExponentialExtrapolator1D: value", 1.0, EXP_EXTRAPOLATOR.interpolate(DATA, value), TOLERANCE_VALUE); value = -0.2; assertEquals("ExponentialExtrapolator1D: value", Math.exp(mLeft * value), EXP_EXTRAPOLATOR.interpolate(DATA, value), TOLERANCE_VALUE); value = 11.0; assertEquals("ExponentialExtrapolator1D: value", Math.exp(mRight * value), EXP_EXTRAPOLATOR.interpolate(DATA, value), TOLERANCE_VALUE); }