Question: How do I define a polynomial with an arbitrary number of terms using sum?

Right now I am going through Bishop's ML book and as a part of the first exercise I need to define a polynomial that goes like this.

y(x,w) = w_0 + w_1 * x + w_2 * x^2 ... + w_m * x^m = sum (k=0 to m) w_k * x^k

Here is how I've written it out in Maple.

f := proc (x, w) options operator, arrow; sum(w[k]*x^k, k = 0 .. nops(w)) end proc

Sorry for the raw code, Maple Math won't accept the code I've written as a valid Maple expression for some reason. When I try to use this I get an error that says too many levels of recursion.

f(2, [a, b, c]);
Error, (in limit/mrv/limsimpl) too many levels of recursion

Where am I going wrong here?
 

Please Wait...