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)
| 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 |
no outgoing calls