0

I am currently plotting the following three functions, which show a discontinuity at 0.7993 (approximately). I am generating the plot with the following code:

Plot[{(p (((3 p)/8 + 5/8) p - 3/16) - 15/32)/(
  p (p^2 + p - 1/2) - 3/4), (p (1/4 p (p + 2) - 1/8) - 3/8)/(
  p (p^2 + p - 1/2) - 3/4), (p (1/8 p (p + 3) - 1/16) - 9/32)/(
  p (p^2 + p - 1/2) - 3/4)}, {p, 0, 1}]

And I am finding the asymptote at 0.7993 by using:

Select[Solve[p (p^2 + p - 1/2) - 3/4 == 0, p], 
 Element[p /. #1, Reals] &]

The output I get is this one:

Output

Then my question is: how can I mark the asymptote with a dotted gray line (or alike)?

Also, would anyone be so kind to briefly give me a hint on how to add labels to the functions and a legend, such as "function 1", "function 2", "function 3", or similar?

corey979
  • 23,947
  • 7
  • 58
  • 101
EoDmnFOr3q
  • 155
  • 1
  • 7

1 Answers1

3

With

p0 = p /. Select[Solve[p (p^2 + p - 1/2) - 3/4 == 0, p], Element[p /. #1, Reals] &][[1]]

one can do

Plot[{(p (((3 p)/8 + 5/8) p - 3/16) - 15/32)/(p (p^2 + p - 1/2) - 
     3/4), (p (1/4 p (p + 2) - 1/8) - 3/8)/(p (p^2 + p - 1/2) - 
     3/4), (p (1/8 p (p + 3) - 1/16) - 9/32)/(p (p^2 + p - 1/2) - 
     3/4)}, {p, 0, 1}, Exclusions -> {p0}, 
 ExclusionsStyle -> Directive[Dotted, Gray], PlotLegends -> Automatic,
  PlotRange -> {All, {-1, 1}}]

enter image description here

For instructive examples on how to modify the legend, see PlotLegends; for various options for plotting, see Plot.

corey979
  • 23,947
  • 7
  • 58
  • 101
  • Thank you for answering my question. As soon as I can, I will accept your (perfect) answer. On top of all this, would it be possible to get some hints on how to modify the aspect, the content and the location of the legend, as well as the dimension of the y-axis? – EoDmnFOr3q Apr 09 '18 at 22:20
  • 1
    The Basic Examples of PlotLegends are very instructive. What do you mean by "modify (...) the dimension of the y-axis"? – corey979 Apr 09 '18 at 22:22
  • Thank you. I'll look into that link asap. What I mean that is to make the plot in such a way that we get to see the y-axis from -1 to 1, instead of seeing it from 0 to 1, as it is now (for example). Does it make better sense now? I don't even know if this is possible. – EoDmnFOr3q Apr 09 '18 at 22:24
  • 1
    See the edited answer for a few additional details. – corey979 Apr 09 '18 at 22:29