67.2.45 problem Problem 18(j)

Internal problem ID [13931]
Book : APPLIED DIFFERENTIAL EQUATIONS The Primary Course by Vladimir A. Dobrushkin. CRC Press 2015
Section : Chapter 4, Second and Higher Order Linear Differential Equations. Problems page 221
Problem number : Problem 18(j)
Date solved : Monday, March 31, 2025 at 08:18:28 AM
CAS classification : [[_2nd_order, _exact, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }+\sin \left (x \right ) y^{\prime }+\cos \left (x \right ) y&=\cos \left (x \right ) \end{align*}

Maple. Time used: 0.002 (sec). Leaf size: 22
ode:=diff(diff(y(x),x),x)+sin(x)*diff(y(x),x)+cos(x)*y(x) = cos(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \left (c_2 +\int \left (c_1 +\sin \left (x \right )\right ) {\mathrm e}^{-\cos \left (x \right )}d x \right ) {\mathrm e}^{\cos \left (x \right )} \]
Mathematica. Time used: 5.257 (sec). Leaf size: 62
ode=D[y[x],{x,2}]+Sin[x]*D[y[x],x]+Cos[x]*y[x]==Cos[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \exp \left (\int _1^x-\sin (K[2])dK[2]\right ) \left (\int _1^x\exp \left (-\int _1^{K[3]}-\sin (K[2])dK[2]\right ) \left (c_1+\int _1^{K[3]}\cos (K[1])dK[1]\right )dK[3]+c_2\right ) \]
Sympy
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(y(x)*cos(x) + sin(x)*Derivative(y(x), x) - cos(x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
NotImplementedError : The given ODE -(-y(x)*cos(x) + cos(x) - Derivative(y(x), (x, 2)))/sin(x) + Derivative(y(x), x) cannot be solved by the factorable group method