65.11.3 problem 18.1 (iii)

Internal problem ID [13713]
Book : AN INTRODUCTION TO ORDINARY DIFFERENTIAL EQUATIONS by JAMES C. ROBINSON. Cambridge University Press 2004
Section : Chapter 18, The variation of constants formula. Exercises page 168
Problem number : 18.1 (iii)
Date solved : Wednesday, March 05, 2025 at 10:13:28 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

Maple. Time used: 0.004 (sec). Leaf size: 35
ode:=diff(diff(y(x),x),x)+4*y(x) = cot(2*x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \sin \left (2 x \right ) c_{2} +\cos \left (2 x \right ) c_{1} +\frac {\sin \left (2 x \right ) \ln \left (\csc \left (2 x \right )-\cot \left (2 x \right )\right )}{4} \]
Mathematica. Time used: 0.119 (sec). Leaf size: 67
ode=D[y[x],{x,2}]+4*y[x]==Cot[2*x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \cos (2 x) \int _1^x-\frac {1}{2} \cos (2 K[1])dK[1]+\sin (2 x) \int _1^x\frac {1}{2} \cos (2 K[2]) \cot (2 K[2])dK[2]+c_1 \cos (2 x)+c_2 \sin (2 x) \]
Sympy. Time used: 0.440 (sec). Leaf size: 42
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(4*y(x) + Derivative(y(x), (x, 2)) - 1/tan(2*x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{2} \cos {\left (2 x \right )} + \left (C_{1} + \frac {\log {\left (\frac {\cos {\left (2 x \right )}}{2} - \frac {1}{2} \right )}}{8} - \frac {\log {\left (\frac {\cos {\left (2 x \right )}}{2} + \frac {1}{2} \right )}}{8}\right ) \sin {\left (2 x \right )} \]