Evaluates polynomial with coefficients xs at point x. return xs[0] + xs[1] * x + xs[1] * x^2 + .... xs[n] * x^n
(xs: list, x: float)
| 48 | |
| 49 | # oracle for HumaneEval/032 |
| 50 | def _poly(xs: list, x: float): |
| 51 | """ |
| 52 | Evaluates polynomial with coefficients xs at point x. |
| 53 | return xs[0] + xs[1] * x + xs[1] * x^2 + .... xs[n] * x^n |
| 54 | """ |
| 55 | return sum([coeff * math.pow(x, i) for i, coeff in enumerate(xs)]) |