0

Currently, I'm plotting a single discrete function f known on a discrete set t using the following code:

t := Vector(3, [0.1, 0.2, 0.3])
f := Vector(3, [1, 2, 3])
DiscretePlot(t, f)

Now, suppose I've got a second function g known at the same set t. How can I plot f and g in the same plot?

0xbadf00d
  • 13,422
  • This question is not appropriate for this site, because it is about how to use Maple, and not about mathematics. It would more suited to http://www.mapleprimes.com or http://stackoverflow.com – acer Feb 27 '19 at 22:48

1 Answers1

1

Here are a few different ways to accomplish that.

restart;
with(DynamicSystems):

t := Vector(3, [0.1, 0.2, 0.3]):

f := Vector(3, [1, 2, 3]):
g := Vector(3, [1, 4, 9]):
h := Vector(3, [1, 8, 27]):

plots:-display(
  DiscretePlot(t, f, color=red),
  DiscretePlot(t, g, color=green),
  DiscretePlot(t, h, color=blue)
);

col_list := [red,green,blue]:
dat_list := [f,g,h]:

plots:-display(zip((a,b)->DiscretePlot(t,a,color=b),
               dat_list, col_list));

plots:-display(seq(DiscretePlot(t, dat_list[i],
                                color=col_list[i]),
               i=1..3));
acer
  • 5,293