Could anyone explain to me why my Maple-Code does not work properly?
with(plots):
plotSet := proc(M)
local n::posint, dispM;
n := nops({M});
dispM := map(i ->
polygonplot([[M[i], 0], [M[i+1], 0], [M[i+1], 1], [M[i], 1]],
color = red),
[$1 .. n]);
display(dispM);
end proc;
If I want to plot following:
plotSet([0, 1/5], [2/5, 3/5]);
Maple just plots the first rectangle. Why doesn't it plot all rectangles?
The short answer is that since you only declared one argument, Maple only sees one argument. That is, M is simply [0, 1/5]. Extra arguments are by default ignored by Maple procedures. You get around this by declaring M to be a sequence via
But after that there are other problems with your procedure. See my comment.
Update: Make the procedure thus:
A better procedure is