@Test public void testChebyCoefficient() { int[][] cCoeffs = MathUtil.getChebyCoefficients(5); int[] expected = {0, -3, 0, 4, 0, 0}; assertArrayEquals(expected, cCoeffs[3]); }
public static int[][] getChebyCoefficients(int k) { int[][] chebyCoeffs = new int[k+1][k+1]; chebyCoeffs[0][0] = 1; if (k == 0) { return chebyCoeffs; } chebyCoeffs[1][1] = 1; for (int i = 2; i <= k; i++) { int[] c1 = chebyCoeffs[i-1]; int[] c2 = chebyCoeffs[i-2]; chebyCoeffs[i][0] = -c2[0]; for (int j = 1; j <= i; j++) { chebyCoeffs[i][j] = 2*c1[j-1] - c2[j]; } } return chebyCoeffs; }
MathUtil { public static int[][] getChebyCoefficients(int k) { int[][] chebyCoeffs = new int[k+1][k+1]; chebyCoeffs[0][0] = 1; if (k == 0) { return chebyCoeffs; } chebyCoeffs[1][1] = 1; for (int i = 2; i <= k; i++) { int[] c1 = chebyCoeffs[i-1]; int[] c2 = chebyCoeffs[i-2]; chebyCoeffs[i][0] = -c2[0]; for (int j = 1; j <= i; j++) { chebyCoeffs[i][j] = 2*c1[j-1] - c2[j]; } } return chebyCoeffs; } }
MathUtil { public static int[][] getChebyCoefficients(int k) { int[][] chebyCoeffs = new int[k+1][k+1]; chebyCoeffs[0][0] = 1; if (k == 0) { return chebyCoeffs; } chebyCoeffs[1][1] = 1; for (int i = 2; i <= k; i++) { int[] c1 = chebyCoeffs[i-1]; int[] c2 = chebyCoeffs[i-2]; chebyCoeffs[i][0] = -c2[0]; for (int j = 1; j <= i; j++) { chebyCoeffs[i][j] = 2*c1[j-1] - c2[j]; } } return chebyCoeffs; }  }
MathUtil { public static int[][] getChebyCoefficients(int k) { int[][] chebyCoeffs = new int[k+1][k+1]; chebyCoeffs[0][0] = 1; if (k == 0) { return chebyCoeffs; } chebyCoeffs[1][1] = 1; for (int i = 2; i <= k; i++) { int[] c1 = chebyCoeffs[i-1]; int[] c2 = chebyCoeffs[i-2]; chebyCoeffs[i][0] = -c2[0]; for (int j = 1; j <= i; j++) { chebyCoeffs[i][j] = 2*c1[j-1] - c2[j]; } } return chebyCoeffs; }  static long[][] getBinomials(int m); static int[][] getChebyCoefficients(int k); static double[] shiftPowerSum(
            double[] powerSums,
            double r,
            double xc
    ); static double[] powerSumsToZerodMoments(
            double[] powerSums,
            double min,
            double max
    ); static double[] powerSumsToChebyMoments(
            double min,
            double max,
            double[] powerSums
    ); static double arrayMean(double[] xs); static void calcPowers(double x, double[] powers); static double entropy(double[] ps); static double getMSE(double[] error); }
MathUtil { public static int[][] getChebyCoefficients(int k) { int[][] chebyCoeffs = new int[k+1][k+1]; chebyCoeffs[0][0] = 1; if (k == 0) { return chebyCoeffs; } chebyCoeffs[1][1] = 1; for (int i = 2; i <= k; i++) { int[] c1 = chebyCoeffs[i-1]; int[] c2 = chebyCoeffs[i-2]; chebyCoeffs[i][0] = -c2[0]; for (int j = 1; j <= i; j++) { chebyCoeffs[i][j] = 2*c1[j-1] - c2[j]; } } return chebyCoeffs; }  static long[][] getBinomials(int m); static int[][] getChebyCoefficients(int k); static double[] shiftPowerSum(
            double[] powerSums,
            double r,
            double xc
    ); static double[] powerSumsToZerodMoments(
            double[] powerSums,
            double min,
            double max
    ); static double[] powerSumsToChebyMoments(
            double min,
            double max,
            double[] powerSums
    ); static double arrayMean(double[] xs); static void calcPowers(double x, double[] powers); static double entropy(double[] ps); static double getMSE(double[] error);  }