# Question:double summation is incorrect BUG?

## Question:double summation is incorrect BUG?

Hy all its my first post, thankyou for having me.
I'm not sure why this happens but say I got a list

X := [0, 1, 2, 3];

and perform this expression

sum(sum(a[k]*X[i]^k, k = 0 .. n), i = 1 .. nops(X))

I get output 4*a[0]+6*a[1]+14*a[2] which is correct and what I want, but if I swap the summations

to

sum(sum(a[k]*X[i]^k, i = 1 .. nops(X)), k = 0 .. n)

I get 3*a[0]+6*a[1]+14*a[2] which is incorrect I believe, unless I'm being silly and missing something.

this happens because its a 0 in my list, if I replace a zero with a non zero number then it works fine and if I replace my set with

X := [seq(x[i], i = 0 .. 3)];
both summations give me
a[2]*x[0]^2+a[2]*x[1]^2+a[2]*x[2]^2+a[2]*x[3]^2+a[1]*x[0]+a[1]*x[1]+a[1]*x[2]+a[1]*x[3]+4*a[0]

and at the end there is 4*a[0]
nothing that is really depending on any element in the list. so why when I replace an element with 0 using the second expression (which should be equivalent to first) gives me less a[0]I really would like to understand why this is happening

any insight or assistance would be gratefully appreciated.(I'm still a noob)

﻿