4.2.21 $$y'(x)=y(x) (a+b y(x) \cos (k x))$$

ODE
$y'(x)=y(x) (a+b y(x) \cos (k x))$ ODE Classiﬁcation

[_Bernoulli]

Book solution method
The Bernoulli ODE

Mathematica
cpu = 0.29513 (sec), leaf count = 57

$\left \{\left \{y(x)\to -\frac {\left (a^2+k^2\right ) e^{a x}}{-\left (c_1 \left (a^2+k^2\right )\right )+b k e^{a x} \sin (k x)+a b e^{a x} \cos (k x)}\right \}\right \}$

Maple
cpu = 0.043 (sec), leaf count = 54

$\left [y \left (x \right ) = -\frac {\left (a^{2}+k^{2}\right ) {\mathrm e}^{a x}}{{\mathrm e}^{a x} k \sin \left (k x \right ) b +a \,{\mathrm e}^{a x} \cos \left (k x \right ) b -\textit {\_C1} \,a^{2}-\textit {\_C1} \,k^{2}}\right ]$ Mathematica raw input

DSolve[y'[x] == y[x]*(a + b*Cos[k*x]*y[x]),y[x],x]

Mathematica raw output

{{y[x] -> -((E^(a*x)*(a^2 + k^2))/(-((a^2 + k^2)*C[1]) + a*b*E^(a*x)*Cos[k*x] +
b*E^(a*x)*k*Sin[k*x]))}}

Maple raw input

dsolve(diff(y(x),x) = (a+b*y(x)*cos(k*x))*y(x), y(x))

Maple raw output

[y(x) = -(a^2+k^2)*exp(a*x)/(exp(a*x)*k*sin(k*x)*b+a*exp(a*x)*cos(k*x)*b-_C1*a^2
-_C1*k^2)]