4.27.29 \(y''(x)-\sin (x) y'(x)+y(x) (-\cos (x))=a-x+x \log (x)\)

ODE
\[ y''(x)-\sin (x) y'(x)+y(x) (-\cos (x))=a-x+x \log (x) \] ODE Classification

[[_2nd_order, _exact, _linear, _nonhomogeneous]]

Book solution method
TO DO

Mathematica
cpu = 25.372 (sec), leaf count = 55

\[\left \{\left \{y(x)\to e^{-\cos (x)} \left (\int _1^x \frac {1}{4} e^{\cos (K[1])} \left (4 a K[1]-3 K[1]^2+2 K[1]^2 \log (K[1])+4 c_1\right ) \, dK[1]+c_2\right )\right \}\right \}\]

Maple
cpu = 0.077 (sec), leaf count = 35

\[ \left \{ y \left ( x \right ) = \left ( {\it \_C2}+\int \! \left ( {\it \_C1}+ax-{\frac {3\,{x}^{2}}{4}}+{\frac {{x}^{2}\ln \left ( x \right ) }{2}} \right ) {{\rm e}^{\cos \left ( x \right ) }}\,{\rm d}x \right ) {{\rm e}^{-\cos \left ( x \right ) }} \right \} \] Mathematica raw input

DSolve[-(Cos[x]*y[x]) - Sin[x]*y'[x] + y''[x] == a - x + x*Log[x],y[x],x]

Mathematica raw output

{{y[x] -> (C[2] + Integrate[(E^Cos[K[1]]*(4*C[1] + 4*a*K[1] - 3*K[1]^2 + 2*K[1]^
2*Log[K[1]]))/4, {K[1], 1, x}])/E^Cos[x]}}

Maple raw input

dsolve(diff(diff(y(x),x),x)-diff(y(x),x)*sin(x)-y(x)*cos(x) = a-x+x*ln(x), y(x),'implicit')

Maple raw output

y(x) = (_C2+Int((_C1+a*x-3/4*x^2+1/2*x^2*ln(x))*exp(cos(x)),x))*exp(-cos(x))