I have the following code that gives you a phase portrait of a 2d system and I can't understand what means the 3rd and 4th line (sol1 and sol2).
sys = {x'[t] == 3 x[t], y'[t] == -y[t]};
ss = DSolve[sys, {x[t], y[t]}, t];
sol1 = ss[[1, 1, 2]];
sol2 = ss[[1, 2, 2]];
toplot = Flatten[
Table[{sol1, sol2} /. {C[1] -> i, C[2] -> j},
{i, -0.5, 0.5, 0.25}, {j, -0.5, 0.5, 0.25}], 1]
graphs = ParametricPlot[Evaluate[toplot], {t, -3, 3}]
I searched the documentation but I couldn't figure it out. Thank you.
@J.M. @belisarius I try to extend it in non linear eqiations. I tried another example with a non linear diff eq. What I wanted to find was the phase space. When I put μ>0 then it plots a solution, but it does not show the other fixed point that is non stable. For everything else μ it does not do anything.
sol = NDSolve[{x'[t] == μ - x[t]^2, y'[t] == -y[t], x[0] == x0,
y[0] == y0}, {x[t], y[t]}, {t, 0, 100}]
toplot = Table[{x@t, y@t} /. sol, {x0, -.5,
2, .25}, {y0, -.5, .5, .25}];
ParametricPlot[Evaluate[toplot], {t, 0, 100}, PlotRange -> All]
I now the dynamics of the above, I do not want you to explain that to me. I want your help because I am trying to learn mathematica.
{sol1, sol2} = {x, y} /. First[ss];
$\endgroup${x@t, y@t} /. First[ss]
in this case $\endgroup$x@t
means? $\endgroup$Part[]
. You will want to look this up in the docs. Additionally,x[t]
,x @ t
, andt // x
all mean the same thing; that is, applying the functionx
to the argumentt
. $\endgroup$[[
and it'll take you toPart
which explains the syntax used in the linesol1 = ...
. The meaning of@
is a bit more difficult to discover. Searching for it takes you toPrefix
, but here's a more relevant doc page. $\endgroup$