12.2.23 problem 23

Internal problem ID [1559]
Book : Elementary differential equations with boundary value problems. William F. Trench. Brooks/Cole 2001
Section : Chapter 2, First order equations. Linear first order. Section 2.1 Page 41
Problem number : 23
Date solved : Saturday, March 29, 2025 at 10:59:05 PM
CAS classification : [_linear]

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

Maple. Time used: 0.002 (sec). Leaf size: 17
ode:=diff(y(x),x)+2*sin(x)*cos(x)*y(x) = exp(-sin(x)^2); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \left (x +c_1 \right ) {\mathrm e}^{-\frac {1}{2}+\frac {\cos \left (2 x \right )}{2}} \]
Mathematica. Time used: 0.072 (sec). Leaf size: 24
ode=D[y[x],x] +(2*Sin[x]*Cos[x])*y[x]==Exp[-Sin[x]^2]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \left (x+\sqrt {e} c_1\right ) e^{-\sin ^2(x)} \]
Sympy. Time used: 1.198 (sec). Leaf size: 26
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(2*y(x)*sin(x)*cos(x) + Derivative(y(x), x) - exp(-sin(x)**2),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{1} e^{\frac {\cos {\left (2 x \right )}}{2}} + x e^{\frac {\cos {\left (2 x \right )}}{2} - \frac {1}{2}} \]