38.2.12 problem 12

Internal problem ID [6441]
Book : Engineering Mathematics. By K. A. Stroud. 5th edition. Industrial press Inc. NY. 2001
Section : Program 24. First order differential equations. Further problems 24. page 1068
Problem number : 12
Date solved : Sunday, March 30, 2025 at 11:01:13 AM
CAS classification : [_linear]

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

Maple. Time used: 0.001 (sec). Leaf size: 14
ode:=diff(y(x),x)+y(x)*tan(x) = sin(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \left (-\ln \left (\cos \left (x \right )\right )+c_1 \right ) \cos \left (x \right ) \]
Mathematica. Time used: 0.05 (sec). Leaf size: 16
ode=D[y[x],x]+y[x]*Tan[x]==Sin[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \cos (x) (-\log (\cos (x))+c_1) \]
Sympy. Time used: 0.453 (sec). Leaf size: 12
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(y(x)*tan(x) - sin(x) + Derivative(y(x), 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 ) \cos {\left (x \right )} \]