Bernoulli equation with exponential forcing (source code)

= Bernoulli equation with exponential forcing
{c}
{title2=$y'=ay+qe^{\lambda x}y^p$}

For $p\ne1$ on a positive real branch, put $v=y^{1-p}$ and $\kappa=(1-p)a$. The <Bernoulli power substitution> gives $v'-\kappa v=(1-p)qe^{\lambda x}$. Its <integrating factor> is $e^{-\kappa x}$, yielding
$$
v=\begin{cases}Ce^{\kappa x}+\dfrac{(1-p)q}{\lambda-\kappa}e^{\lambda x},&\lambda\ne\kappa,\\e^{\kappa x}[C+(1-p)qx],&\lambda=\kappa.\end{cases}
$$
The resonant case needs an extra factor x because the forcing has the same exponential dependence as the homogeneous solution. Recover $y=v^{1/(1-p)}$ only on an appropriate real branch. The case $p=1$ is already a <first-order linear differential equation>; a zero solution or zero-crossing behavior must be checked in the original equation separately.