0
$\begingroup$

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]

$\endgroup$
1
$\begingroup$

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

$\endgroup$
2
  • $\begingroup$ I was considering something like that, but did not try it as the documentation examples (au.mathworks.com/help/symbolic/mupad_ref/plot-sum.html) were not in that format. $\endgroup$
    – Dimpl
    May 22 '16 at 15:34
  • $\begingroup$ Additionally, the original format I provided works if a matrix is used, rather than a list. Would you be able to explain why? $\endgroup$
    – Dimpl
    May 22 '16 at 15:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.