# Streamplot of an ODE [closed]

I'm trying to make a streamplot of

$\qquad \frac{dy}{dx}=|y(x)|$

together with a couple of streamlines. I got stuck in the syntax. Can anyone help me out of it?

This what I've done:

sp = StreamPlot[{1, Abs[y[x]]}, {x, 0, 4}, {y[x], -4, 4}];
sol = y /. ParametricNDSolve[{y'[x] == Abs[y[x]], y == a}, y, {x, 0, 4}, a];
Manipulate[
Show[
sp,
Plot[Evaluate[sol[a][x]], {x, 0, 4},
PlotStyle -> Red,
PlotRange -> Full],
Epilog -> {Black, PointSize[0.02], Point[{0, a}]}],
{a, 0, 4}]

• Where did you get stuck? Please post your code... – anderstood Mar 24 '18 at 12:04
• This was most welcome :) Apparantely I have a steep learning curve. One question. In the code below how can I make thick red lines?sol = DSolve[{Q'[t] == 2 - 2/3*Q[t], Q == q0}, Q[t], t] Show[Plot[ Evaluate[Table[Q[t] /. sol /. {q0 -> i}, {i, 0, 4, 1}]], {t, 0, 6}, PlotStyle -> {Red, Red, Red, Red}], StreamPlot[{1, 2 - 2/3*Q[t]}, {t, 0, 6}, {Q[t], 0, 6}, StreamMarkers -> "PinDart", StreamStyle -> Gray], AspectRatio -> 1, AxesLabel -> {"t", "Q(t)"}, PlotRange -> All] – runner Mar 24 '18 at 19:05

Use StreamPlot

sp = StreamPlot[{1, Abs[y]}, {x, 0, 2 Pi}, {y, 0, 2 Pi}] sol[y0_?NumericQ] :=
NDSolve[{D[y[x], x] == Abs[y[x]], y == y0}, y, {x, -5, 5}]

scp = Plot[Evaluate[{y[x]} /. sol[#] & /@ Range[0, 20, 0.3]], {x, -3, 3},
PlotRange -> All, MaxRecursion -> 8, AxesLabel -> {"x", "y"}, PlotStyle -> Red]

Show[sp,scp ] • Ok, but I would like to see a use of e.g NDSolve together with some boundary conditions – runner Mar 24 '18 at 11:40
• Then you should have mentioned that in your question, @user. – J. M.'s ennui Mar 24 '18 at 11:41