# Sum equation with equation and get an equation

I am trying to get an equation from summing other equations but it doesn't result in a correct answer. Is there another way of doing this?

n = 4; xList = {1, 2, 3, 4, 5}; yList = {4, 5, 6, 8, 7};
equation[x_] = a*(x^4) + b*(x^3) + c*(x^2) + d*(x^1) + e*(x^0);
eqSummer = 0;

Do[
eqSummer = eqSummer +  equation[xList[[i]]];
, {i, 1, Length[xList]}
];

eqSum
36768/25 + (512 c)/5 + 10 e

-
What are n and yList for? I assume eqSummer and eqSum are the same thing and the code has been edited? – Ymareth Jan 14 '14 at 9:11

equation[x_] = a*(x^4) + b*(x^3) + c*(x^2) + d*(x^1) + e*(x^0);


and

Total[Map[equation, {1, 2, 3, 4, 5}]]


gives 979 a + 225 b + 55 c + 15 d + 5 e

-
It is, thank you – Teodor Kostadinov Jan 14 '14 at 9:35

The code boils down to:

listableQ[f_] := MemberQ[Attributes[f], Listable]
protected = Unprotect[Equal]

Equal/: lhs:f_Symbol?listableQ[___, _Equal, ___] :=