3
$\begingroup$

Drawing a StreamPlot of a linear dynamical system:

A = {{9, -15}, {7, -9}};
StreamPlot[A.{x, y}, {x, -2, 2}, {y, -2, 2}, StreamPoints -> Coarse]

enter image description here

results in a few colinear points inside the ellipse. I guess they are some degenerate arrows, but it looks very confusing, so how to get rid of those? (They stay there when StreamPoints -> Medium as well, although less abundant.)

$Version

"12.1.1 for Linux x86 (64-bit) (June 19, 2020)"

$\endgroup$
3
$\begingroup$

Delete short arrows?:

A = {{9, -15}, {7, -9}};
StreamPlot[A . {x, y}, {x, -2, 2}, {y, -2, 2}, 
  StreamPoints -> Coarse] /. 
 Arrow[a_] /; Total[Norm /@ Differences[a]] < 0.1 :> {}

enter image description here

$\endgroup$
3
  • $\begingroup$ Note to editor(s): Norm[Differences[a]] is a matrix norm of an $(n-1) \times 2$ of the difference vectors of the coordinates of the $n$ points of each arrow, the meaning of which escapes me; Total[Norm /@ Differences[a]] gives the length of the arrow. A slightly simpler formulation would be ArcLength[Line@a]. It would be really nice if ArcLength worked with Arrow, but it does not. $\endgroup$
    – Michael E2
    Feb 5 at 16:57
  • $\begingroup$ Norm[Differences[a]] works in this code. $\endgroup$ Feb 5 at 22:24
  • $\begingroup$ @rhomboidRhipper It implements a selection criterion that, luckily, happens to work, but it's the wrong idea and not equivalent. It would result in the deletion of a = Table[{x, Sin[x]}, {x, 0., 0.5, 0.01}];, which would be wrong, since Arrow[a] makes a rather long arrow. The difference above if < 0.1 is changed to < 0.2 is evident, too. $\endgroup$
    – Michael E2
    Feb 6 at 2:25
3
$\begingroup$

Set the aratio and npts in SteamScale maybe one method.

A = {{9, -15}, {7, -9}};
StreamPlot[A . {x, y}, {x, -2, 2}, {y, -2, 2}, StreamPoints -> Coarse,
  StreamScale -> {Automatic, 2, .01, Automatic}]

enter image description here

$\endgroup$
1
  • $\begingroup$ Ingenious, but changing anything, like AspectRatio -> 1/GoldenRatio, makes the arrows display ugly, and then altering StreamScale make the degenerate arrows appear again. $\endgroup$
    – corey979
    Feb 5 at 1:16

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.