Some equations are difficult to solve, so perhaps we can plot a function of the equation to see roughly how the solution looks. The same is true for differential equations, where we can observe the integral curve by drawing its slope field.
I have a differential equation: $$ y^2=4+4\left(\frac{dy}{dx}\right)^2 $$ Then I can get $y'=±\sqrt{\frac{y^2-4}{4}}$. So I want to plot the $+$ part:
StreamPlot[{1, Sqrt[((y^2 - 4)/4) ]}, {x, -1, 5}, {y, 0, 4}]
But actually I know the solution of this differential equations from here is:
sol[x_]:=1/2 (c E^(x/2)+(4 E^(-x/2))/c)
And then something strange happened:
c = 1;
sol[x_] := 1/2 (c E^(x/2) + (4 E^(-(x/2)))/c);
Show[StreamPlot[{1, Sqrt[1/4 (y^2 - 4)]}, {x, -1, 5}, {y, 0, 5}],
Plot[Evaluate[sol[x]], {x, -1, 6}, AxesOrigin -> {0, 0},
PlotStyle -> Blue]]
It looks like this slope field is only correct within a certain range (e.g. the right-hand side). But exactly where the turning point is, we may need sol
to determine that. But the purpose of my drawing the slope field is to know the information of sol
, how can I in turn draw the slope field by the information of sol
? This is confusing me. So I ask here.
Is there any way I can draw the direction field correctly without any information from sol
?
sol[x_]
is not a solution to the + part, no? It's a solution to the orginal DE, though, yes? (The direction field is two-valued, as you point out, but you draw only one of the values....It's unclear to me why it's confusing.) $\endgroup$sol[x]
was (including the + and - parts) but I found I needed thesol[x]
itself to know which part of the slope field was correct and which part was wrong. This seems to defeat my original purpose of drawing the slope field. So I feel confused $\endgroup$StreamPlot
). A solution to the + part has the form $$y(x)= \begin{cases} \left(e^{-\frac{1}{2} \left(x-x_0\right)}+e^{\frac{1}{2} \left(x-x_0\right)}\right) & x>x_0 \\ 2 & x\le x_0 \end{cases}$$ $\endgroup$DSolve
, though, unless it has improved its handling of singular solutions. (See previously linked answer.) $\endgroup$