35.3.11 problem 11

Internal problem ID [6115]
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 : Sunday, March 30, 2025 at 10:39:08 AM
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)+y(x)*cos(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.081 (sec). Leaf size: 20
ode=D[y[x],x]+y[x]*Cos[x]==Sin[2*x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to 2 \sin (x)+c_1 e^{-\sin (x)}-2 \]
Sympy. Time used: 45.995 (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 \]