20.11.7 problem Problem 10

Internal problem ID [3789]
Book : Differential equations and linear algebra, Stephen W. Goode and Scott A Annin. Fourth edition, 2015
Section : Chapter 8, Linear differential equations of order n. Section 8.9, Reduction of Order. page 572
Problem number : Problem 10
Date solved : Sunday, March 30, 2025 at 02:08:35 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }+y&=\csc \left (x \right ) \end{align*}

Using reduction of order method given that one solution is

\begin{align*} y&=\sin \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.019 (sec). Leaf size: 24
ode=D[y[x],{x,2}]+y[x]==Csc[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to (-x+c_1) \cos (x)+\sin (x) (\log (\sin (x))+c_2) \]
Sympy. Time used: 0.222 (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 )} \]