I have faced with problem of not completely correct phase trajectories of ODE, which was produced by StreamPlot.

Next following code ends up with this plot:

 f[x_, y_] = x/(-x - 2 y)
 StreamPlot[{1, f[x, y]}, {x, -10, 10}, {y, -10, 10}, Frame -> False, 
 Axes -> True, AspectRatio -> 1/GoldenRatio, StreamStyle -> "PinDart"]

Phase trajectoies

Unfortunately, streamlines are interrupting on line $y = -\dfrac{x}{2}$, when they should go as they were. By this, I mean that there should be only clockwise directed streamlines.

Is there any straightforward way to deal with this issue? Thank you!

  • 1
    $\begingroup$ But are you sure this is not right? y=-x/2 is where the direction of tangent changes. Just plug in x=-1, y=1 above this line and x=-1 y=0 below this line, and you get the slope of +1 for the former case and -1 for the latter case. $\endgroup$ – MathX Mar 19 '16 at 0:38
  • $\begingroup$ What is the ODE you're trying to plot the trajectories of? $\endgroup$ – Rahul Mar 19 '16 at 1:34
  • $\begingroup$ @Rahul This one: $ y' = \dfrac{x}{-x-2y} $ $\endgroup$ – RuD_wow Mar 20 '16 at 13:44
  • 1
    $\begingroup$ @RuD_wow: The denominator of that ODE cannot be $y = -\dfrac{x}{2}$, else the ODE is undefined. This is a line as shown in the phase portrait, so the phase portrait you show above is is correct. $\endgroup$ – Moo Mar 20 '16 at 14:22
  • $\begingroup$ @Moo But, what if we will calculate the eigenvalues of system $\dfrac{dx}{dt}, \dfrac{dy}{dt} $ and, considering their Real values, make a conclusion that DE' s phase trajectories are logarithmic clockwise spiral? $\endgroup$ – RuD_wow Mar 21 '16 at 18:12

Will this do the trick:

f[x_, y_] := {1, x/(-x - 2 y)};
f[x_, y_] /; y > -x/2 := -{1, x/(-x - 2 y)};
StreamPlot[f[x, y], {x, -10, 10}, {y, -10, 10}, Frame -> False, 
 Axes -> True, AspectRatio -> 1/GoldenRatio, StreamStyle -> "PinDart"]
  • $\begingroup$ Thank you a lot! I was thining about the same tricky way, but stucked on how to implement it. $\endgroup$ – RuD_wow Mar 20 '16 at 14:26

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.