4.24.48 \(y''(x)+4 y(x)=x \sin ^2(x)\)

ODE
\[ y''(x)+4 y(x)=x \sin ^2(x) \] ODE Classification

[[_2nd_order, _linear, _nonhomogeneous]]

Book solution method
TO DO

Mathematica
cpu = 0.254585 (sec), leaf count = 41

\[\left \{\left \{y(x)\to \frac {1}{128} \left (\left (-8 x^2+1+128 c_2\right ) \sin (2 x)+16 x-4 (x-32 c_1) \cos (2 x)\right )\right \}\right \}\]

Maple
cpu = 0.769 (sec), leaf count = 42

\[\left [y \left (x \right ) = \sin \left (2 x \right ) \textit {\_C2} +\cos \left (2 x \right ) \textit {\_C1} -\frac {\sin \left (2 x \right ) x^{2}}{16}+\frac {x}{8}+\frac {\sin \left (2 x \right )}{128}-\frac {x \cos \left (2 x \right )}{32}\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))

Maple raw output

[y(x) = sin(2*x)*_C2+cos(2*x)*_C1-1/16*sin(2*x)*x^2+1/8*x+1/128*sin(2*x)-1/32*x*
cos(2*x)]