15.12.18 problem 18

Internal problem ID [3162]
Book : Differential Equations by Alfred L. Nelson, Karl W. Folley, Max Coral. 3rd ed. DC heath. Boston. 1964
Section : Exercise 20, page 90
Problem number : 18
Date solved : Sunday, March 30, 2025 at 01:20:02 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

Maple. Time used: 0.003 (sec). Leaf size: 41
ode:=diff(diff(y(x),x),x)+4*y(x) = sec(x)*tan(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \left (-2 \cos \left (x \right )^{2}+1\right ) \ln \left (\sec \left (x \right )+\tan \left (x \right )\right )+2 c_1 \cos \left (x \right )^{2}-c_1 +2 \sin \left (x \right ) \cos \left (x \right ) c_2 -2 \sin \left (x \right ) \]
Mathematica. Time used: 0.079 (sec). Leaf size: 33
ode=D[y[x],{x,2}]+4*y[x]==Sec[x]*Tan[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \cos (2 x) (-\text {arctanh}(\sin (x)))+c_1 \cos (2 x)+2 \sin (x) (-1+c_2 \cos (x)) \]
Sympy. Time used: 1.004 (sec). Leaf size: 37
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(4*y(x) + Derivative(y(x), (x, 2)) - tan(x)/cos(x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{2} \sin {\left (2 x \right )} + \left (C_{1} + \frac {\log {\left (\sin {\left (x \right )} - 1 \right )}}{2} - \frac {\log {\left (\sin {\left (x \right )} + 1 \right )}}{2}\right ) \cos {\left (2 x \right )} - 2 \sin {\left (x \right )} \]