29.3.11 problem 11

Internal problem ID [7250]
Book : Mathematical Methods in the Physical Sciences. third edition. Mary L. Boas. John Wiley. 2006
Section : Chapter 8, Ordinary differential equations. Section 3. Linear First-Order Equations. page 403
Problem number : 11
Date solved : Tuesday, September 30, 2025 at 04:26:13 PM
CAS classification : [_linear]

\begin{align*} y^{\prime }+y \cos \left (x \right )&=\sin \left (2 x \right ) \end{align*}
Maple. Time used: 0.001 (sec). Leaf size: 17
ode:=diff(y(x),x)+cos(x)*y(x) = sin(2*x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = 2 \sin \left (x \right )-2+{\mathrm e}^{-\sin \left (x \right )} c_1 \]
Mathematica. Time used: 0.029 (sec). Leaf size: 53
ode=D[y[x],x]+y[x]*Cos[x]==Sin[2*x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to \exp \left (\int _1^x-\cos (K[1])dK[1]\right ) \left (\int _1^x\exp \left (-\int _1^{K[2]}-\cos (K[1])dK[1]\right ) \sin (2 K[2])dK[2]+c_1\right ) \end{align*}
Sympy. Time used: 46.458 (sec). Leaf size: 15
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(y(x)*cos(x) - sin(2*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 )}} + 2 \sin {\left (x \right )} - 2 \]