0

I need to plot all of the curves generated using a Maple for loop. As an example, consider the simple loop:

For j from 1 by 1 to 10
    do
        plot({[f(x,j),g(x,j), x=x_min..x_max]}, options)
    end do;

I need to plot all of the curves so generated under one set of axes. What I have here seems to plot only one curve, corresponding to the value j=10.

1 Answers1

1

While it is possible to use a for loop to do this, it is neither preferable nor Maple-ish. It is much better to use Maple's looping operator, seq.

plot([seq([f(x,j), g(x,j), x= x_min..x_max], j= 1..10)]);

If you have multiple plots generated with various plotting commands, you can combine them on the same set of axes with display.

A:= plot(...): B:= plot(...): plots:-display([A,B]);

or simply

plots:-display([plot(...), plot(...)]);

Carl Love
  • 1,193
  • Thank you, this is very helpful. Let me extend my initial question a bit. Suppose that we have two such "sequences" of plots, and we want to plot them concurrently. For example, plot seq([f(x,j),g(x,j),x=x_min..x_max],j=1..10) and seq([p(x,j),q(x,j),x=x_min..x_max],j=1..10) on the same set of axes. How would you modify your suggestion above to do this task? – Math_Life Nov 29 '14 at 17:46
  • Okay, I expanded the answer to fulfill the request in your comment. – Carl Love Nov 29 '14 at 18:01