maple: How to show two lines on each other in a plot?

666 Views Asked by At

I am plotting two functions, which have very little difference from each other. When plotting with maple, considering my precision (12 digits), the plot shows one line. I know this is normal, but I want to show both lines as below: the first one with red color (for instance) and the second one on the first on with blue color and a dashed linestyle.

Does any one know how I can do this?

Thanks for the help.

1

There are 1 best solutions below

0
On

The first way displays both with a single call to plot.

plot([x^2, x^2+0.1], x=-4..4, color=[red,blue], linestyle=[solid,dot]);

enter image description here

This second way produces each separately and then displays then together. (Your two curves may come from two different plotting commands, and not just from plot say.) As you can see the end result looks the same as from the first way above.

P1:=plot(x^2, x=-4..4, color=red, linestyle=solid):
P2:=plot(x^2+0.1, x=-4..4, color=blue, linestyle=dot):
plots:-display(P1,P2);

enter image description here

The various values for the linestyle option are any of solid, dot, dash, dashdot, longdash, spacedash, or spacedot. Details of this kind of thing can be found on the plot,options help-page.