40.9.11 problem 21

Internal problem ID [6721]
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 : Wednesday, March 05, 2025 at 02:40:09 AM
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.071 (sec). Leaf size: 86
ode=D[y[x],{x,2}]-y[x]==Csc[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \left (\frac {1}{2}+\frac {i}{2}\right ) e^{i x} \left (\operatorname {Hypergeometric2F1}\left (\frac {1}{2}-\frac {i}{2},1,\frac {3}{2}-\frac {i}{2},e^{2 i x}\right )+i \operatorname {Hypergeometric2F1}\left (\frac {1}{2}+\frac {i}{2},1,\frac {3}{2}+\frac {i}{2},e^{2 i x}\right )\right )+c_1 e^x+c_2 e^{-x} \]
Sympy. Time used: 0.270 (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 )} \]