### Question:
LaguerrePolynomialFunction extends OrthogonalPolynomialFunctionGenerator { @Override public DoubleFunction1D[] getPolynomials(int n) { return getPolynomials(n, 0); }  @Override DoubleFunction1D[] getPolynomials(int n); @Override Pair<DoubleFunction1D, DoubleFunction1D>[] getPolynomialsAndFirstDerivative(int n); DoubleFunction1D[] getPolynomials(int n, double alpha); Pair<DoubleFunction1D, DoubleFunction1D>[] getPolynomialsAndFirstDerivative(int n, double alpha);  }### Answer:
@Test public void testBadN1() { assertThatIllegalArgumentException() .isThrownBy(() -> LAGUERRE.getPolynomials(-3)); }
@Test public void testBadN2() { assertThatIllegalArgumentException() .isThrownBy(() -> LAGUERRE.getPolynomials(-3, 1)); }
@Test public void test() { DoubleFunction1D[] l = LAGUERRE.getPolynomials(0); assertThat(l.length).isEqualTo(1); final double x = 1.23; assertThat(l[0].applyAsDouble(x)).isCloseTo(1, offset(EPS)); l = LAGUERRE.getPolynomials(1); assertThat(l.length).isEqualTo(2); assertThat(l[1].applyAsDouble(x)).isCloseTo(1 - x, offset(EPS)); for (int i = 0; i <= 6; i++) { l = LAGUERRE.getPolynomials(i); for (int j = 0; j <= i; j++) { assertThat(L[j].applyAsDouble(x)).isCloseTo(l[j].applyAsDouble(x), offset(EPS)); } } }
@Test public void testAlpha1() { DoubleFunction1D[] l1, l2; final double x = 2.34; for (int i = 0; i <= 6; i++) { l1 = LAGUERRE.getPolynomials(i, 0); l2 = LAGUERRE.getPolynomials(i); for (int j = 0; j <= i; j++) { assertThat(l1[j].applyAsDouble(x)).isCloseTo(l2[j].applyAsDouble(x), offset(EPS)); } } final double alpha = 3.45; l1 = LAGUERRE.getPolynomials(6, alpha); final DoubleFunction1D f0 = d -> 1d; final DoubleFunction1D f1 = d -> 1 + alpha - d; final DoubleFunction1D f2 = d -> d * d / 2 - (alpha + 2) * d + (alpha + 2) * (alpha + 1) / 2.; final DoubleFunction1D f3 = d -> -d * d * d / 6 + (alpha + 3) * d * d / 2 - (alpha + 2) * (alpha + 3) * d / 2 + (alpha + 1) * (alpha + 2) * (alpha + 3) / 6; assertThat(l1[0].applyAsDouble(x)).isCloseTo(f0.applyAsDouble(x), offset(EPS)); assertThat(l1[1].applyAsDouble(x)).isCloseTo(f1.applyAsDouble(x), offset(EPS)); assertThat(l1[2].applyAsDouble(x)).isCloseTo(f2.applyAsDouble(x), offset(EPS)); assertThat(l1[3].applyAsDouble(x)).isCloseTo(f3.applyAsDouble(x), offset(EPS)); }