Question: Summing a list vs. a vector

The following is not a profound problem, and there is an obvious solution,

but it came up, and I would like to learn more about it.

 

Even though I recommend the add procedure when summing up individual entities,

my students keep showing me how smart the sum procedure is. Which makes

our worksheets more readable and reproducible for Maple users who are less frequent.

 

For example:

 

restart; Xlist := [1, 2, 3]; N := numelems(Xlist)

3

Using palette icon:

sum(Xlist[n], n = 1 .. N)

6

Cool!  Which means

sum(Xlist[n], n = 1 .. N)

6

But if we use the same palette icon for a vector

Xvector := convert(Xlist, Vector); sum(Xvector[n], n = 1 .. N)

Error, bad index into Vector

Because I believe this fails

sum(Xvector[n], n = 1 .. N)

Error, bad index into Vector

 

Would someone please teach me how I can see why the sum of a list

works, but does the sum of a vector fail?

Download MaplePrimes_sum_list_vector.mw

Please Wait...