class GaussJacobiWeightAndAbscissaFunction implements QuadratureWeightAndAbscissaFunction {

  @Override
  public GaussianQuadratureData generate(final int n) {
    Validate.isTrue(n > 0, "n > 0");
    final Pair<DoubleFunction1D, DoubleFunction1D>[] polynomials = JACOBI.getPolynomialsAndFirstDerivative(n, _alpha, _beta);
    final Pair<DoubleFunction1D, DoubleFunction1D> pair = polynomials[n];
    final DoubleFunction1D previous = polynomials[n - 1].getFirst();
    final DoubleFunction1D function = pair.getFirst();
    final DoubleFunction1D derivative = pair.getSecond();
    final double[] x = new double[n];
    final double[] w = new double[n];
    double root = 0;
    for (int i = 0; i < n; i++) {
      final double d = 2 * n + _c;
      root = getInitialRootGuess(root, i, n, x);
      root = ROOT_FINDER.getRoot(function, derivative, root);
      x[i] = root;
      w[i] = GAMMA_FUNCTION.evaluate(_alpha + n) * GAMMA_FUNCTION.evaluate(_beta + n) / MathUtils.factorialDouble(n) / GAMMA_FUNCTION.evaluate(n + _c + 1) * d * Math.pow(2, _c)
          / (derivative.evaluate(root) * previous.evaluate(root));
    }
    return new GaussianQuadratureData(x, w);
  }

  public  GaussJacobiWeightAndAbscissaFunction();
  public  GaussJacobiWeightAndAbscissaFunction(final double alpha, final double beta);

}