In general, LGTM. Few notes:
The name
fis meaningless.newtonDeltaperhaps?It feels right to compute a derivative's coefficients once, and reuse
evalPolyfor both the function and its derivative. After all, the polynomial's derivative is also polynomial. There is an usual space-time tradeoff, but in thisthe case of polynomials DRY rule casts a deciding vote.Newton's algorithm does not necessarily converge. You should be prepared to handle the divergent case.
Hardcoding
εis dubious. I recommend tosolveNewtonhave it as a parameter.Using Horner schedule is a definite improvement.