29.2.6 problem 31

Internal problem ID [4639]
Book : Ordinary differential equations and their solutions. By George Moseley Murphy. 1960
Section : Various 2
Problem number : 31
Date solved : Tuesday, March 04, 2025 at 06:59:54 PM
CAS classification : [_linear]

\begin{align*} y^{\prime }&=\sin \left (2 x \right )-y \tan \left (x \right ) \end{align*}

Maple. Time used: 0.002 (sec). Leaf size: 13
ode:=diff(y(x),x) = sin(2*x)-y(x)*tan(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y \left (x \right ) = \left (-2 \cos \left (x \right )+c_{1} \right ) \cos \left (x \right ) \]
Mathematica. Time used: 0.044 (sec). Leaf size: 15
ode=D[y[x],x]==Sin[2*x]-y[x]*Tan[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \cos (x) (-2 \cos (x)+c_1) \]
Sympy. Time used: 0.553 (sec). Leaf size: 12
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(y(x)*tan(x) - sin(2*x) + Derivative(y(x), x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \left (C_{1} - 2 \cos {\left (x \right )}\right ) \cos {\left (x \right )} \]