64.12.6 problem 6

Internal problem ID [13439]
Book : Differential Equations by Shepley L. Ross. Third edition. John Willey. New Delhi. 2004.
Section : Chapter 4, Section 4.4. Variation of parameters. Exercises page 162
Problem number : 6
Date solved : Monday, March 31, 2025 at 07:57:55 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

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