22.1.65 problem 66

Internal problem ID [4371]
Book : Differential equations for engineers by Wei-Chau XIE, Cambridge Press 2010
Section : Chapter 2. First-Order and Simple Higher-Order Differential Equations. Page 78
Problem number : 66
Date solved : Tuesday, September 30, 2025 at 07:23:38 AM
CAS classification : [_linear]

\begin{align*} y^{\prime }&=\left (\sin \left (x \right )^{2}-y\right ) \cos \left (x \right ) \end{align*}
Maple. Time used: 0.002 (sec). Leaf size: 23
ode:=diff(y(x),x) = (sin(x)^2-y(x))*cos(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = 3+{\mathrm e}^{-\sin \left (x \right )} c_1 -\cos \left (x \right )^{2}-2 \sin \left (x \right ) \]
Mathematica. Time used: 0.083 (sec). Leaf size: 30
ode=D[y[x],x]==( Sin[x]^2-y[x])*Cos[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to -2 \sin (x)-\frac {1}{2} \cos (2 x)+c_1 e^{-\sin (x)}+\frac {5}{2} \end{align*}
Sympy. Time used: 0.370 (sec). Leaf size: 20
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq((y(x) - sin(x)**2)*cos(x) + Derivative(y(x), x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{1} e^{- \sin {\left (x \right )}} + \sin ^{2}{\left (x \right )} - 2 \sin {\left (x \right )} + 2 \]