IncompleteGammaFunction extends Function1D<Double, Double> { @Override public Double evaluate(final Double x) { try { return Gamma.regularizedGammaP(_a, x, _eps, _maxIter); } catch (final org.apache.commons.math.MathException e) { throw new MathException(e); } } IncompleteGammaFunction(final double a);  IncompleteGammaFunction(final double a, final int maxIter, final double eps); @Override Double evaluate(final Double x);  }
@Test public void testLimits() { assertEquals(FUNCTION.evaluate(0.), 0, EPS); assertEquals(FUNCTION.evaluate(100.), 1, EPS); }
@Test public void test() { final Function1D<Double, Double> f = new Function1D<Double, Double>() { @Override public Double evaluate(final Double x) { return 1 - Math.exp(-x); } }; final double x = 4.6; assertEquals(f.evaluate(x), FUNCTION.evaluate(x), EPS); }