Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have written a function that is meant to illustrate the solution of a DE:

ShowDESolution[f_, {xa_, xb_}, {ya_, yb_}] := 
  Animate[VectorPlot[{1, f[x, y]}, {x, xa, xb}, {y, ya, yb},
    VectorStyle -> Arrowheads[0],
    VectorScale -> {Tiny, Automatic, None},
    Axes -> True,
    StreamPoints -> {1, Automatic, r},
    StreamStyle -> {Directive[Red, Thick], "Line"},
    ColorFunction -> "Rainbow", (* for LineIntegralConvolutionPlot *)
    ImageSize -> 800], {r, 0, xb - xa}];
ShowDESolution[f_, {a_, b_}] := ShowDESolution[f, {a, b}, {-b, b}];
ShowDESolution[f_] := ShowDESolution[f, {-3, 3}];

This function, however, has the problem that the length of streamlines can only be set when the streamline seeds are explicitly given. (The max streamline length is the third term in StreamPoints, r.) If I replace the 1 in StreamPoints with {{-xa, 0}}, for example, the animation works just fine. But if I leave the 1 there, the streamline will be the same length regardless of r. Is there any way I could get the optimal streamline seed for that graph and put it in as an explicit seed? Or set the length of implicitly seeded streamlines?

share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.