34.9.11 problem 21

Internal problem ID [8008]
Book : Schaums Outline. Theory and problems of Differential Equations, 1st edition. Frank Ayres. McGraw Hill 1952
Section : Chapter 14. Linear equations with constant coefficients. Supplemetary problems. Page 92
Problem number : 21
Date solved : Tuesday, September 30, 2025 at 05:14:10 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }+y&=\csc \left (x \right ) \end{align*}
Maple. Time used: 0.002 (sec). Leaf size: 24
ode:=diff(diff(y(x),x),x)+y(x) = csc(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = -\ln \left (\csc \left (x \right )\right ) \sin \left (x \right )+\left (-x +c_1 \right ) \cos \left (x \right )+\sin \left (x \right ) c_2 \]
Mathematica. Time used: 0.061 (sec). Leaf size: 66
ode=D[y[x],{x,2}]-y[x]==Csc[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to e^{-x} \left (e^{2 x} \int _1^x\frac {1}{2} e^{-K[1]} \csc (K[1])dK[1]+\int _1^x-\frac {1}{2} e^{K[2]} \csc (K[2])dK[2]+c_1 e^{2 x}+c_2\right ) \end{align*}
Sympy. Time used: 0.135 (sec). Leaf size: 19
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(y(x) + Derivative(y(x), (x, 2)) - 1/sin(x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \left (C_{1} - x\right ) \cos {\left (x \right )} + \left (C_{2} + \log {\left (\sin {\left (x \right )} \right )}\right ) \sin {\left (x \right )} \]