6.10.19 problem 19

Internal problem ID [1823]
Book : Elementary differential equations with boundary value problems. William F. Trench. Brooks/Cole 2001
Section : Chapter 5 linear second order equations. Section 5.7 Variation of Parameters. Page 262
Problem number : 19
Date solved : Friday, October 03, 2025 at 01:20:33 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} \sin \left (x \right ) y^{\prime \prime }+\left (2 \sin \left (x \right )-\cos \left (x \right )\right ) y^{\prime }+\left (\sin \left (x \right )-\cos \left (x \right )\right ) y&={\mathrm e}^{-x} \end{align*}
Maple. Time used: 0.098 (sec). Leaf size: 53
ode:=sin(x)*diff(diff(y(x),x),x)+(2*sin(x)-cos(x))*diff(y(x),x)+(sin(x)-cos(x))*y(x) = exp(-x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = {\mathrm e}^{\arcsin \left (\cos \left (x \right )\right )} \left (c_2 +c_1 \cos \left (x \right )-\int \csc \left (x \right )^{2} {\mathrm e}^{-\arcsin \left (\cos \left (x \right )\right )-x}d x \cos \left (x \right )+\int \cot \left (x \right ) \csc \left (x \right ) {\mathrm e}^{-\arcsin \left (\cos \left (x \right )\right )-x}d x \right ) \]
Mathematica. Time used: 0.204 (sec). Leaf size: 41
ode=Sin[x]*D[y[x],{x,2}]+(2*Sin[x]-Cos[x])*D[y[x],x]+(Sin[x]-Cos[x])*y[x]==Exp[-x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to -\sqrt {\sin ^2(x)} e^{-\arccos (\cos (x))}+c_1 e^{\arcsin (\cos (x))}+c_2 \cos (x) e^{\arcsin (\cos (x))} \end{align*}
Sympy
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq((sin(x) - cos(x))*y(x) + (2*sin(x) - cos(x))*Derivative(y(x), x) + sin(x)*Derivative(y(x), (x, 2)) - exp(-x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
NotImplementedError : The given ODE Derivative(y(x), x) - (-sqrt(2)*y(x)*exp(x)*cos(x + pi/4) + exp(x)*sin(x)*Derivative(y(x), (x, 2)) - 1)*exp(-x)/(-2*sin(x) + cos(x)) cannot be solved by the factorable group method