MuPAD: plot sum of list elements

467 Views Asked by At

I am receiving an unclear error when trying to plot partial sums of elements of a list in MuPAD. Any suggestions would be appreciated.

d := [1, 2, 3]:
plot::Sum(d[i], i = 1..nops(d)):

Error: Duplicate identifiers '{d[i]}' were found in range specifications. [plot::Sum::new]

1

There are 1 best solutions below

2
On BEST ANSWER

As per the documentation, plot::Sum expects an expression (or a function) for the first argument, but you're passing it a list (DOM_LIST). You can easily create a function/procedure using the -> operator:

d := [1, 2, 3]:
plot(plot::Sum(i->d[i], i = 1..nops(d))):

This produces a plot like this:

plot