6.10.1 problem 1

Internal problem ID [1805]
Book : Elementary differential equations with boundary value problems. William F. Trench. Brooks/Cole 2001
Section : Chapter 5 linear second order equations. Section 5.7 Variation of Parameters. Page 262
Problem number : 1
Date solved : Tuesday, September 30, 2025 at 05:19:42 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }+9 y&=\tan \left (3 x \right ) \end{align*}
Maple. Time used: 0.002 (sec). Leaf size: 33
ode:=diff(diff(y(x),x),x)+9*y(x) = tan(3*x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \sin \left (3 x \right ) c_2 +\cos \left (3 x \right ) c_1 -\frac {\cos \left (3 x \right ) \ln \left (\sec \left (3 x \right )+\tan \left (3 x \right )\right )}{9} \]
Mathematica. Time used: 0.047 (sec). Leaf size: 33
ode=D[y[x],{x,2}]+9*y[x]==Tan[3*x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to -\frac {1}{9} \cos (3 x) \text {arctanh}(\sin (3 x))+c_1 \cos (3 x)+c_2 \sin (3 x) \end{align*}
Sympy. Time used: 0.275 (sec). Leaf size: 36
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(9*y(x) - tan(3*x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{2} \sin {\left (3 x \right )} + \left (C_{1} + \frac {\log {\left (\sin {\left (3 x \right )} - 1 \right )}}{18} - \frac {\log {\left (\sin {\left (3 x \right )} + 1 \right )}}{18}\right ) \cos {\left (3 x \right )} \]