23.3.26 problem 26

Internal problem ID [5740]
Book : Ordinary differential equations and their solutions. By George Moseley Murphy. 1960
Section : Part II. Chapter 3. THE DIFFERENTIAL EQUATION IS LINEAR AND OF SECOND ORDER, page 311
Problem number : 26
Date solved : Tuesday, September 30, 2025 at 02:02:21 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} 4 y+y^{\prime \prime }&=2 \tan \left (x \right ) \end{align*}
Maple. Time used: 0.002 (sec). Leaf size: 40
ode:=4*y(x)+diff(diff(y(x),x),x) = 2*tan(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = 2 \ln \left (\cos \left (x \right )\right ) \sin \left (x \right ) \cos \left (x \right )+\left (2 c_1 -2 x \right ) \cos \left (x \right )^{2}+\sin \left (x \right ) \left (2 c_2 +1\right ) \cos \left (x \right )+x -c_1 \]
Mathematica. Time used: 0.013 (sec). Leaf size: 33
ode=4*y[x] + D[y[x],{x,2}] == 2*Tan[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to (-x+c_1) \cos (2 x)+\sin (x) \cos (x) (2 \log (\cos (x))-1+2 c_2) \end{align*}
Sympy. Time used: 0.511 (sec). Leaf size: 22
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(4*y(x) - 2*tan(x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \left (C_{1} - x\right ) \cos {\left (2 x \right )} + \left (C_{2} + \log {\left (\cos {\left (x \right )} \right )}\right ) \sin {\left (2 x \right )} \]