ODE
\[ y''(x)+4 y(x)=x \sin ^2(x) \] ODE Classification
[[_2nd_order, _linear, _nonhomogeneous]]
Book solution method
TO DO
Mathematica ✓
cpu = 0.108201 (sec), leaf count = 41
\[\left \{\left \{y(x)\to \frac {1}{128} \left (\left (128 c_2-8 x^2+1\right ) \sin (2 x)-4 \left (x-32 c_1\right ) \cos (2 x)+16 x\right )\right \}\right \}\]
Maple ✓
cpu = 0.083 (sec), leaf count = 37
\[ \left \{ y \left ( x \right ) ={\frac { \left ( -8\,{x}^{2}+128\,{\it \_C2}+1 \right ) \sin \left ( 2\,x \right ) }{128}}+{\frac { \left ( -4\,x+128\,{\it \_C1} \right ) \cos \left ( 2\,x \right ) }{128}}+{\frac {x}{8}} \right \} \] Mathematica raw input
DSolve[4*y[x] + y''[x] == x*Sin[x]^2,y[x],x]
Mathematica raw output
{{y[x] -> (16*x - 4*(x - 32*C[1])*Cos[2*x] + (1 - 8*x^2 + 128*C[2])*Sin[2*x])/12
8}}
Maple raw input
dsolve(diff(diff(y(x),x),x)+4*y(x) = x*sin(x)^2, y(x),'implicit')
Maple raw output
y(x) = 1/128*(-8*x^2+128*_C2+1)*sin(2*x)+1/128*(-4*x+128*_C1)*cos(2*x)+1/8*x