20.9.7 problem Problem 7

Internal problem ID [3751]
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.7, The Variation of Parameters Method. page 556
Problem number : Problem 7
Date solved : Tuesday, March 04, 2025 at 05:11:33 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }+9 y&=\frac {36}{4-\cos \left (3 x \right )^{2}} \end{align*}

Maple. Time used: 0.006 (sec). Leaf size: 61
ode:=diff(diff(y(x),x),x)+9*y(x) = 36/(4-cos(3*x)^2); 
dsolve(ode,y(x), singsol=all);
 
\[ y \left (x \right ) = \frac {4 \sqrt {3}\, \arctan \left (\frac {\sqrt {3}\, \sin \left (3 x \right )}{3}\right ) \sin \left (3 x \right )}{3}+\sin \left (3 x \right ) c_{2} -\cos \left (3 x \right ) \ln \left (\cos \left (3 x \right )-2\right )+\cos \left (3 x \right ) \ln \left (\cos \left (3 x \right )+2\right )+\cos \left (3 x \right ) c_{1} \]
Mathematica. Time used: 0.209 (sec). Leaf size: 61
ode=D[y[x],{x,2}]+9*y[x]==36/(4-Cos[3*x]^2); 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \frac {4 \sin (3 x) \arctan \left (\frac {\sin (3 x)}{\sqrt {3}}\right )}{\sqrt {3}}+c_2 \sin (3 x)+\cos (3 x) (-\log (2-\cos (3 x))+\log (\cos (3 x)+2)+c_1) \]
Sympy. Time used: 0.907 (sec). Leaf size: 78
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(9*y(x) + Derivative(y(x), (x, 2)) - 36/(4 - cos(3*x)**2),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \left (C_{1} - \frac {4 \sqrt {3} \operatorname {atan}{\left (\frac {\sqrt {3} \tan {\left (\frac {3 x}{2} \right )}}{3} \right )}}{3} + \frac {4 \sqrt {3} \operatorname {atan}{\left (\sqrt {3} \tan {\left (\frac {3 x}{2} \right )} \right )}}{3}\right ) \sin {\left (3 x \right )} + \left (C_{2} - \log {\left (\cos {\left (3 x \right )} - 2 \right )} + \log {\left (\cos {\left (3 x \right )} + 2 \right )}\right ) \cos {\left (3 x \right )} \]