4.24.40 \(y''(x)+y(x)=\tan ^2(x)\)

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

[[_2nd_order, _linear, _nonhomogeneous]]

Book solution method
TO DO

Mathematica
cpu = 0.083973 (sec), leaf count = 50

\[\left \{\left \{y(x)\to c_1 \cos (x)+\sin (x) \left (c_2-\log \left (\cos \left (\frac {x}{2}\right )-\sin \left (\frac {x}{2}\right )\right )+\log \left (\sin \left (\frac {x}{2}\right )+\cos \left (\frac {x}{2}\right )\right )\right )-2\right \}\right \}\]

Maple
cpu = 0.09 (sec), leaf count = 27

\[ \left \{ y \left ( x \right ) =\sin \left ( x \right ) {\it \_C2}+\cos \left ( x \right ) {\it \_C1}-2+\sin \left ( x \right ) \ln \left ( {\frac {1+\sin \left ( x \right ) }{\cos \left ( x \right ) }} \right ) \right \} \] Mathematica raw input

DSolve[y[x] + y''[x] == Tan[x]^2,y[x],x]

Mathematica raw output

{{y[x] -> -2 + C[1]*Cos[x] + (C[2] - Log[Cos[x/2] - Sin[x/2]] + Log[Cos[x/2] + S
in[x/2]])*Sin[x]}}

Maple raw input

dsolve(diff(diff(y(x),x),x)+y(x) = tan(x)^2, y(x),'implicit')

Maple raw output

y(x) = sin(x)*_C2+cos(x)*_C1-2+sin(x)*ln((1+sin(x))/cos(x))