# How to plot Bernouli Differential equation?

I have 2 questions.

Bernoulli differential equation: $$y'(x)-y(x)=\dfrac{\mathrm e^x}{y(x)}$$

When solving this step by step following this Clay Roose book [page 81, Example 3.13(M)], I get one solution $$\sqrt{\mathrm e^x \left(c_1 \mathrm e^x-2\right)}$$.

When i solve this with DSolve, I get $$\left\{\left\{y(x)\to -\mathrm e^{x/2} \sqrt{c_1 \mathrm e^x-2}\right\}, \left\{y(x)\to \mathrm e^{x/2} \sqrt{c_1 \mathrm e^x-2}\right\}\right\}$$.

Questions are:

1. Why is there difference and where is mistake in solving step by step?

2. I know how to plot if I am going step by step, but how to plot solve which I get with DSolve because there are 2x branches of solve?

• It seems that when building an analytical solution you only took the positive solution branch and left out the negative one. – Alexei Boulbitch Nov 21 '18 at 10:30

eqn = y'[x] - y[x] == E^x/y[x];

sol = DSolve[eqn, y, x]

(* {{y -> Function[{x}, -E^(x/2) Sqrt[-2 + E^x C[1]]]}, {y ->
Function[{x}, E^(x/2) Sqrt[-2 + E^x C[1]]]}} *)


Both solutions satisfy the equation

eqn /. sol // Simplify

(* {True, True} *)

Plot[Evaluate[
Table[Tooltip[y[x] /. sol /. C[1] -> c], {c, {1, 5, 10}}]], {x, -2, 4},
PlotRange -> {-50, 50}, PlotLegends -> "Expressions"]