29.1.5 problem 4

Internal problem ID [4612]
Book : Ordinary differential equations and their solutions. By George Moseley Murphy. 1960
Section : Various 1
Problem number : 4
Date solved : Sunday, March 30, 2025 at 03:30:24 AM
CAS classification : [[_linear, `class A`]]

\begin{align*} y^{\prime }&=a \cos \left (b x +c \right )+k y \end{align*}

Maple. Time used: 0.001 (sec). Leaf size: 40
ode:=diff(y(x),x) = a*cos(b*x+c)+k*y(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = {\mathrm e}^{k x} c_1 +\frac {a \left (b \sin \left (b x +c \right )-\cos \left (b x +c \right ) k \right )}{b^{2}+k^{2}} \]
Mathematica. Time used: 0.121 (sec). Leaf size: 43
ode=D[y[x],x]==a*Cos[b*x+c]+k*y[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \frac {a (b \sin (b x+c)-k \cos (b x+c))}{b^2+k^2}+c_1 e^{k x} \]
Sympy. Time used: 0.182 (sec). Leaf size: 42
from sympy import * 
x = symbols("x") 
a = symbols("a") 
b = symbols("b") 
c = symbols("c") 
k = symbols("k") 
y = Function("y") 
ode = Eq(-a*cos(b*x + c) - k*y(x) + Derivative(y(x), x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{1} e^{k x} + \frac {a b \sin {\left (b x + c \right )}}{b^{2} + k^{2}} - \frac {a k \cos {\left (b x + c \right )}}{b^{2} + k^{2}} \]