MCPcopy Create free account
hub / github.com/EdwardRaff/JSAT / hornerPolyR

Method hornerPolyR

JSAT/src/jsat/math/MathTricks.java:138–144  ·  view source on GitHub ↗

This evaluates a polynomial using Horner's method. It is assumed that the polynomial is stored in reverse order in the array coef, ie: from c n at index 0, and then decreasing. @param coef the polynomial with coefficients in reverse order @param x the value to evaluate the polynom

(double[] coef, double x)

Source from the content-addressed store, hash-verified

136 * @return the value of the polynomial at {@code x}
137 */
138 public static double hornerPolyR(double[] coef, double x)
139 {
140 double result = 0;
141 for(double c : coef)
142 result = result*x+c;
143 return result;
144 }
145
146 /**
147 * This evaluates a polynomial using Horner's method. It is assumed that the

Callers 3

testHornerPolyRMethod · 0.95
digammaMethod · 0.80
zetaMethod · 0.80

Calls

no outgoing calls

Tested by 1

testHornerPolyRMethod · 0.76