@Test public void testDerivate() { assertCoefficientsEquals(new double[]{B, 2 * C}, valueOf(A, B, C).derivate()); assertCoefficientsEquals(new double[]{0}, valueOf(A).derivate()); }
public Polynomial derivate() { if (degree == 0) { return Polynomial.ZERO; } double[] result = Doubles.fromDegree(degree - 1); for (int i = 1; i <= degree; ++i) { result[i - 1] = i * get(i); } return new Polynomial(result, degree - 1); }
Polynomial implements IReadDataBlock { public Polynomial derivate() { if (degree == 0) { return Polynomial.ZERO; } double[] result = Doubles.fromDegree(degree - 1); for (int i = 1; i <= degree; ++i) { result[i - 1] = i * get(i); } return new Polynomial(result, degree - 1); } }
Polynomial implements IReadDataBlock { public Polynomial derivate() { if (degree == 0) { return Polynomial.ZERO; } double[] result = Doubles.fromDegree(degree - 1); for (int i = 1; i <= degree; ++i) { result[i - 1] = i * get(i); } return new Polynomial(result, degree - 1); } private  Polynomial(final double[] coefficients, final int degree); }
Polynomial implements IReadDataBlock { public Polynomial derivate() { if (degree == 0) { return Polynomial.ZERO; } double[] result = Doubles.fromDegree(degree - 1); for (int i = 1; i <= degree; ++i) { result[i - 1] = i * get(i); } return new Polynomial(result, degree - 1); } private  Polynomial(final double[] coefficients, final int degree); static Division divide(final Polynomial num, final Polynomial denom); @Override void copyTo(double[] buffer, int start); @Override int getLength(); @Override IReadDataBlock rextract(int start, int length); static Complex[] checkRoots(final Complex[] roots); static double getEpsilon(); static Polynomial of(double[] coefficients); static Polynomial copyOf(double[] coefficients); static Polynomial copyOf(double[] coefficients, int start, int end); static Polynomial valueOf(double firstCoefficient, double... nextCoefficients); static Polynomial fromComplexRoots(Complex[] roots); static Polynomial fromComplexRoots(final Complex[] roots, final double c); static Polynomial fromData(IReadDataBlock data); static Polynomial factor(double c, int n); static void setEpsilon(final double value); static IRootsSolver getDefRootsSearcher(); static void setDefRootsSearcher(final IRootsSolver value); Polynomial adjustDegree(); Polynomial derivate(); Polynomial divide(final double d); Polynomial divide(final Polynomial r); @Override boolean equals(final Object obj); boolean equals(Polynomial other, double epsilon); Complex evaluateAt(final Complex x); double evaluateAt(final double x); static double revaluate(final double[] c, final double x); static double evaluate(final double[] c, final double x); static double evaluate(final int degree, IntToDoubleFunction fn, final double x); Complex evaluateAtFrequency(final double w); @Override double get(final int idx); double[] getCoefficients(); int getDegree(); @Override int hashCode(); boolean isZero(); boolean isIdentity(); Polynomial minus(double d); Polynomial minus(final Polynomial r); Polynomial mirror(); Polynomial negate(); Polynomial plus(final double d); Polynomial plus(final Polynomial r); Complex[] roots(); Complex[] roots(IRootsSolver searcher); Polynomial smooth(); Polynomial times(final double d); Polynomial times(final Polynomial r); Polynomial times(final Polynomial r, boolean computeroots); @Override String toString(); String toString(final char var, final boolean bSmooth); String toString(final String fmt, final char var,
            final boolean bSmooth); }
Polynomial implements IReadDataBlock { public Polynomial derivate() { if (degree == 0) { return Polynomial.ZERO; } double[] result = Doubles.fromDegree(degree - 1); for (int i = 1; i <= degree; ++i) { result[i - 1] = i * get(i); } return new Polynomial(result, degree - 1); } private  Polynomial(final double[] coefficients, final int degree); static Division divide(final Polynomial num, final Polynomial denom); @Override void copyTo(double[] buffer, int start); @Override int getLength(); @Override IReadDataBlock rextract(int start, int length); static Complex[] checkRoots(final Complex[] roots); static double getEpsilon(); static Polynomial of(double[] coefficients); static Polynomial copyOf(double[] coefficients); static Polynomial copyOf(double[] coefficients, int start, int end); static Polynomial valueOf(double firstCoefficient, double... nextCoefficients); static Polynomial fromComplexRoots(Complex[] roots); static Polynomial fromComplexRoots(final Complex[] roots, final double c); static Polynomial fromData(IReadDataBlock data); static Polynomial factor(double c, int n); static void setEpsilon(final double value); static IRootsSolver getDefRootsSearcher(); static void setDefRootsSearcher(final IRootsSolver value); Polynomial adjustDegree(); Polynomial derivate(); Polynomial divide(final double d); Polynomial divide(final Polynomial r); @Override boolean equals(final Object obj); boolean equals(Polynomial other, double epsilon); Complex evaluateAt(final Complex x); double evaluateAt(final double x); static double revaluate(final double[] c, final double x); static double evaluate(final double[] c, final double x); static double evaluate(final int degree, IntToDoubleFunction fn, final double x); Complex evaluateAtFrequency(final double w); @Override double get(final int idx); double[] getCoefficients(); int getDegree(); @Override int hashCode(); boolean isZero(); boolean isIdentity(); Polynomial minus(double d); Polynomial minus(final Polynomial r); Polynomial mirror(); Polynomial negate(); Polynomial plus(final double d); Polynomial plus(final Polynomial r); Complex[] roots(); Complex[] roots(IRootsSolver searcher); Polynomial smooth(); Polynomial times(final double d); Polynomial times(final Polynomial r); Polynomial times(final Polynomial r, boolean computeroots); @Override String toString(); String toString(final char var, final boolean bSmooth); String toString(final String fmt, final char var,
            final boolean bSmooth); static final Polynomial ZERO; static final Polynomial ONE; }