Maple plotting and loops

2.8k Views Asked by At

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

There are 1 best solutions below

2
On

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(...)]);