4
$\begingroup$

Why doesn't the red line start precisely at the defined point $(0, 2)$ and go off to infinity?

My initial condition is $(0, 2)$ and I only want to see where that trajectory goes off to.

  StreamPlot[{1, y (y - 1)}, {x, -5, 5}, {y, - 5, 5}, 
   StreamPoints -> {{{{0, 2}, Red}, Automatic}}]

enter image description here

Why did it add everything before that? What would be nice is to show the initial point as a point on the phase portrait in red at $(0,2)$ and then the red line that goes off toward infinity.

$\endgroup$
  • $\begingroup$ In other words, you want the red streamline to only be traced forward and not backward from the point $(0,2)$? $\endgroup$ – Rahul Dec 9 '15 at 3:42
  • $\begingroup$ @Rahul: That is correct. I could have sworn that previous versions did not go backward in time, so it seems like something changed in newer versions that automatically does that. $\endgroup$ – Moo Dec 9 '15 at 3:49
6
$\begingroup$

I think you understand why, so I will focus on the part of the question that is constructive: how to draw the phase portrait that you've described.

One approach is to concatenate one StreamPlot that only draws the red line with another StreamPlot that draws all the other arrows. However, care has to be taken so that there is room for the red arrow in the second StreamPlot and also so that the size of the red arrows is the same as the size of the rest.

sp = StreamPlot[
  {1, y (y - 1)}, {x, -5, 5}, {y, -5, 5},
  StreamPoints -> {{{{0, 2}, White}, Automatic}},
  Epilog -> {Red, PointSize[Large], Point[{0, 2}]}
  ]

Mathematica graphics

sp2 = StreamPlot[
  {1, y (y - 1)}, {x, -5, 5}, {y, -5, 5},
  StreamPoints -> {{{{0, 2}, Red}}},
  RegionFunction -> (# > 0 &)
  ]

Mathematica graphics

Show[sp, sp2]

Mathematica graphics

$\endgroup$
  • $\begingroup$ Thank you, I could have sworn this didn't go backward in time and add that extra information in previous versions, but this gets the job done! $\endgroup$ – Moo Dec 9 '15 at 3:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.