views:

64

answers:

2

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?

+6  A: 

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.

Jim Lewis
Thank you. I'm surprised I didn't think of calculating the common (x+1) and then plugging in and factoring.
Planeman
+1  A: 

3(x+1)^2 + 5(x+1)^4 = (x+1)^2[3 + 5(x+1)^2].

I can do that in 5 operations:

1) x+1
2) (x+1)^2
3) 5(x+1)^2
4) 5(x+1)^2 + 3
5) (x+1)^2[5(x+1)^2 + 3]
Keith Randall