15.11.10 problem 10

Internal problem ID [3120]
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 : 10
Date solved : Tuesday, March 04, 2025 at 04:00:31 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }-9 y&={\mathrm e}^{3 x}+\sin \left (3 x \right ) \end{align*}

Maple. Time used: 0.004 (sec). Leaf size: 31
ode:=diff(diff(y(x),x),x)-9*y(x) = exp(3*x)+sin(3*x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {\left (36 c_2 +6 x -1\right ) {\mathrm e}^{3 x}}{36}+c_{1} {\mathrm e}^{-3 x}-\frac {\sin \left (3 x \right )}{18} \]
Mathematica. Time used: 0.239 (sec). Leaf size: 39
ode=D[y[x],{x,2}]-9*y[x]==Exp[3*x]+Sin[3*x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to -\frac {1}{18} \sin (3 x)+e^{3 x} \left (\frac {x}{6}-\frac {1}{36}+c_1\right )+c_2 e^{-3 x} \]
Sympy. Time used: 0.126 (sec). Leaf size: 26
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-9*y(x) - exp(3*x) - sin(3*x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{2} e^{- 3 x} + \left (C_{1} + \frac {x}{6}\right ) e^{3 x} - \frac {\sin {\left (3 x \right )}}{18} \]