Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have some explicit time-independent vector field on the plane, and I would like to study how points evolve under the flow generated by this vector field. The flow is rather complicated and cannot be solved explicitly.

For my purposes, it is important to analyze how a "curve" of initial conditions end up after a fixed time, say $t=1$. Is there any command in Mathematica that would do this job? I have read much documentation but could not find anything like this. Any help will be greatly appreciated.

To be concrete,

s = 
   {x'[t] == -y[t] + x[t]*Log[x[t]], y'[t] == x[t] + y[t]*Log[x[t]], 
    x[0] == 1, y[0] == 0}, 
   {x, y}, {t, 1}]

and I would like to plot the image of the line segment $1<x<2,\,y=0$ after time 1.

share|improve this question
Welcome to Mathematica.SE! I suggest the following: 0) Browse the common pitfalls question 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! – Dr. belisarius Feb 19 at 18:35
Thank you very much for your comments! – user45824 Feb 19 at 18:48
up vote 11 down vote accepted
s = ParametricNDSolveValue[{x'[t] == -y[t] + x[t]*Log[x[t]], 
                            y'[t] ==  x[t] + y[t]*Log[x[t]], 
                            x[0] == x0, y[0] == 0}, {x, y}, {t, 1}, x0]
f[x0_, t_] := Through[Through[s@x0]@t]

pts = Table[f[x0, t], {x0, 1, 2, .2}, {t, 0, 1, .1}];
Show[Graphics[{Green, Arrow /@ pts, Black, Point /@ pts}, 
              Axes -> True, AxesOrigin -> {0, -1}], 
     ParametricPlot[f[x0, 1], {x0, 1, 2}, PlotStyle -> {Thick, Red}], 
     ParametricPlot[f[x0, 0], {x0, 1, 2}, PlotStyle -> {Thick, Blue}]]

Mathematica graphics


pts = Table[f[x0, t], {x0, 1, 2, .2}, {t, 0, 1, .1}];
ptsind = Transpose[{(Range@Length@# - 1)/(Length@# - 1), #} &@Transpose@pts];

  {Green, Arrow /@ pts,
  {Thick, Blend[{Blue, Red}, #[[1]]], Line@#[[2]]} & /@ ptsind},
  Axes -> True, AxesOrigin -> {0, -1}]

Mathematica graphics

share|improve this answer
Thank you very much! This is perfect for my purposes. It will be very useful in my studies. – user45824 Feb 19 at 18:30

Make the position along the curve be another parameter of the differential equation.

s = NDSolve[{D[x[t, x0], t] == -y[t, x0] + x[t, x0]*Log[x[t, x0]], 
   D[y[t, x0], t] == x[t, x0] + y[t, x0]*Log[x[t, x0]], 
   x[0, x0] == x0, y[0, x0] == 0}, {x, y}, {t, 1}, {x0, 1, 2}];
 Table[{x[t, x0], y[t, x0]} /. s, {t, 0, 1, 0.1}], {x0, 1, 2}]

enter image description here

share|improve this answer
Thank you very much! This was exactly what I was looking for; my apologies for not being able to accept multiple answers. – user45824 Feb 19 at 18:31

Your Answer


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

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