Search code examples
algorithmperformancepolynomial-mathcomputation

Efficient polynomial evaluation with Horner's Algorithm


I have the equation y = 3(x+1)^2 + 5(x+1)^4.

Using Horner's scheme I could evaluate this polynomial in this form, y = 8+x(26+x(33+x(20+5x))), thus requiring 8 arithmetic operations.

I could also evaluate it in this form, y = (x+1)^2 * ((5x+10)x+8), requiring 7 operations.

I've been told this can be done in 5 operations but Horner's algorithm is supposed to be most efficient and it can only do it in 7 operations. Am I missing something?


Solution

  • Let a = (x+1)^2, that's 2 ops. Then y=3a + 5a^2 = a(3+5a), 3 more ops for a total of 5.