15.11.21 problem 21

Internal problem ID [3131]
Book : Differential Equations by Alfred L. Nelson, Karl W. Folley, Max Coral. 3rd ed. DC heath. Boston. 1964
Section : Exercise 19, page 86
Problem number : 21
Date solved : Sunday, March 30, 2025 at 01:19:08 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }+2 n y^{\prime }+n^{2} y&=5 \cos \left (6 x \right ) \end{align*}

Maple. Time used: 0.003 (sec). Leaf size: 53
ode:=diff(diff(y(x),x),x)+2*n*diff(y(x),x)+n^2*y(x) = 5*cos(6*x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {\left (n^{2}+36\right )^{2} \left (c_1 x +c_2 \right ) {\mathrm e}^{-n x}+5 \cos \left (6 x \right ) n^{2}+60 \sin \left (6 x \right ) n -180 \cos \left (6 x \right )}{\left (n^{2}+36\right )^{2}} \]
Mathematica. Time used: 0.045 (sec). Leaf size: 57
ode=D[y[x],{x,2}]+2*n*D[y[x],{x,2}]+n^2*y[x]==5*Cos[6*x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \frac {5 \cos (6 x)}{n^2-72 n-36}+c_1 e^{\frac {n x}{\sqrt {-2 n-1}}}+c_2 e^{-\frac {n x}{\sqrt {-2 n-1}}} \]
Sympy. Time used: 0.318 (sec). Leaf size: 68
from sympy import * 
x = symbols("x") 
n = symbols("n") 
y = Function("y") 
ode = Eq(n**2*y(x) + 2*n*Derivative(y(x), x) - 5*cos(6*x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \frac {5 n^{2} \cos {\left (6 x \right )}}{n^{4} + 72 n^{2} + 1296} + \frac {60 n \sin {\left (6 x \right )}}{n^{4} + 72 n^{2} + 1296} + \left (C_{1} + C_{2} x\right ) e^{- n x} - \frac {180 \cos {\left (6 x \right )}}{n^{4} + 72 n^{2} + 1296} \]