78.14.9 problem 4 (a)

Internal problem ID [18274]
Book : DIFFERENTIAL EQUATIONS WITH APPLICATIONS AND HISTORICAL NOTES by George F. Simmons. 3rd edition. 2017. CRC press, Boca Raton FL.
Section : Chapter 3. Second order linear equations. Section 19. The Method of Variation of Parameters. Problems at page 135
Problem number : 4 (a)
Date solved : Monday, March 31, 2025 at 05:24:31 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

Maple. Time used: 0.002 (sec). Leaf size: 22
ode:=diff(diff(y(x),x),x)+y(x) = sec(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = -\ln \left (\sec \left (x \right )\right ) \cos \left (x \right )+\cos \left (x \right ) c_1 +\sin \left (x \right ) \left (x +c_2 \right ) \]
Mathematica. Time used: 0.018 (sec). Leaf size: 22
ode=D[y[x],{x,2}] +y[x]==Sec[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to (x+c_2) \sin (x)+\cos (x) (\log (\cos (x))+c_1) \]
Sympy. Time used: 0.196 (sec). Leaf size: 19
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(y(x) + Derivative(y(x), (x, 2)) - 1/cos(x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \left (C_{1} + x\right ) \sin {\left (x \right )} + \left (C_{2} + \log {\left (\cos {\left (x \right )} \right )}\right ) \cos {\left (x \right )} \]