### Question:
GaussJacobiWeightAndAbscissaFunction implements QuadratureWeightAndAbscissaFunction { @Override public GaussianQuadratureData generate(int n) { ArgChecker.isTrue(n > 0, "n > 0"); Pair<DoubleFunction1D, DoubleFunction1D>[] polynomials = JACOBI.getPolynomialsAndFirstDerivative(n, _alpha, _beta); Pair<DoubleFunction1D, DoubleFunction1D> pair = polynomials[n]; DoubleFunction1D previous = polynomials[n - 1].getFirst(); DoubleFunction1D function = pair.getFirst(); DoubleFunction1D derivative = pair.getSecond(); double[] x = new double[n]; double[] w = new double[n]; double root = 0; for (int i = 0; i < n; i++) { 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.applyAsDouble(_alpha + n) * GAMMA_FUNCTION.applyAsDouble(_beta + n) / CombinatoricsUtils.factorialDouble(n) / GAMMA_FUNCTION.applyAsDouble(n + _c + 1) * d * Math.pow(2, _c) / (derivative.applyAsDouble(root) * previous.applyAsDouble(root)); } return new GaussianQuadratureData(x, w); } GaussJacobiWeightAndAbscissaFunction();  GaussJacobiWeightAndAbscissaFunction(double alpha, double beta); @Override GaussianQuadratureData generate(int n);  }### Answer:
@Test public void test() { final int n = 12; final GaussianQuadratureData f1 = GAUSS_LEGENDRE.generate(n); final GaussianQuadratureData f2 = GAUSS_JACOBI_GL_EQUIV.generate(n); final GaussianQuadratureData f3 = GAUSS_JACOBI_CHEBYSHEV_EQUIV.generate(n); final double[] w1 = f1.getWeights(); final double[] w2 = f2.getWeights(); final double[] x1 = f1.getAbscissas(); final double[] x2 = f2.getAbscissas(); assertThat(w1.length == w2.length).isTrue(); assertThat(x1.length == x2.length).isTrue(); for (int i = 0; i < n; i++) { assertThat(w1[i]).isCloseTo(w2[i], offset(EPS)); assertThat(x1[i]).isCloseTo(-x2[i], offset(EPS)); } final double[] w3 = f3.getWeights(); final double[] x3 = f3.getAbscissas(); final double chebyshevWeight = Math.PI / n; final Function<Integer, Double> chebyshevAbscissa = new Function<Integer, Double>() { @Override public Double apply(final Integer x) { return -Math.cos(Math.PI * (x + 0.5) / n); } }; for (int i = 0; i < n; i++) { assertThat(chebyshevWeight).isCloseTo(w3[i], offset(EPS)); assertThat(chebyshevAbscissa.apply(i)).isCloseTo(-x3[i], offset(EPS)); } }