# Why is StreamPoints not seeding correctly?

I am attempting to make a parametric stream plot of a dynamical system that is seeded along a line of points. For some reason, Mathematica inconsistently seeds at these points and will actually sometimes seed the wrong points (as shown below).

Is this a Mathematica issue, or is there a problem with my code?

I've visualized the seeding points as well in the StreamPlot to show the points appear to be defined correctly. Toggling the parameter makes the arrows coming from the other points appear and disappear inconsistently. The problem is also not unique to a specific dynamical system.

My code:

xpoints = ConstantArray[-2, 11];
ypoints = Range[-2, 2, 0.4];
points = Transpose[{xpoints, ypoints}]
Manipulate[
StreamPlot[{y, -a x^3}, {x, -3, 3}, {y, -3, 3},
StreamPoints -> points, Epilog -> Point[points]],
{a, 0, 1}]

• It sometimes removes stream lines if they get too close to one another. It does this automatically, which can make it very hard to use it to produce exactly what you want. Having to a pretty good job at illustrating a phase portrait is fairly easy, though. You can use NDSolve directly to create the stream lines, though. – Michael E2 Mar 1 '19 at 2:44
• Manipulate[ StreamPlot[{y, -a*x^3}, {x, -3, 3}, {y, -3, 3}, StreamPoints -> {points, 0.001}, Epilog -> Point[points]], {a, 0, 1}] eventually leads to a kernel crash, after clicking the dialog buttons to abort and to disable dynamic updating. – Michael E2 Mar 1 '19 at 11:49

I don't think there's any problem with your code, not do I think you found a bug. What I think is happening is that StreamPlot is making some automatic choices because you didn't give a complete specification for StreamPoints and you are unhappy with those choices,

First, let's look a slightly modified version of you code that shows what value of a appears to go wrong.

xpoints = ConstantArray[-2, 11];
ypoints = Range[-2, 2, .4];
points = Transpose[{xpoints, ypoints}];

Manipulate[
StreamPlot[{y, -a x^3}, {x, -3, 3}, {y, -3, 3},
StreamPoints -> points,
Epilog -> {Red, AbsolutePointSize[5], Point[points]}],
{a, 0, 1, .02, Appearance -> "Labeled"}]


The plot you show in your question shows up at a = 0.28. Now, let's look at the same plot with a full specification for StreamPoints.

Manipulate[
StreamPlot[{y, -a x^3}, {x, -3, 3}, {y, -3, 3},
StreamPoints -> {points, Automatic, Scaled[b]},
Epilog -> {Red, AbsolutePointSize[5], Point[points]}],
{{a, .28}, 0, 1, .02, Appearance -> "Labeled"},
{{b, 2}, 0, 5, .1, Appearance -> "Labeled"}]


The problem has been corrected.

• Still a bit disappointing that the length has to be adjusted manually and the stream lines go around more than once so that the arrows overlap. – Michael E2 Mar 1 '19 at 11:43
• @MichaelE2. I agree, but it's the best I have been able to do given the choices that WRI has made in their implementation the StreamPoints option. My guess is that the implementors weren't thinking about the use case this question illustrates. – m_goldberg Mar 1 '19 at 15:59