38.4.10 problem 10

Internal problem ID [6496]
Book : Engineering Mathematics. By K. A. Stroud. 5th edition. Industrial press Inc. NY. 2001
Section : Program 25. Second order differential equations. Further problems 25. page 1094
Problem number : 10
Date solved : Wednesday, March 05, 2025 at 12:52:59 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

Maple. Time used: 0.004 (sec). Leaf size: 29
ode:=diff(diff(y(x),x),x)-9*y(x) = exp(3*x)+sin(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {\left (-1+6 x +36 c_1 \right ) {\mathrm e}^{3 x}}{36}+{\mathrm e}^{-3 x} c_2 -\frac {\sin \left (x \right )}{10} \]
Mathematica. Time used: 0.123 (sec). Leaf size: 37
ode=D[y[x],{x,2}]-9*y[x]==Exp[3*x]+Sin[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to -\frac {\sin (x)}{10}+e^{3 x} \left (\frac {x}{6}-\frac {1}{36}+c_1\right )+c_2 e^{-3 x} \]
Sympy. Time used: 0.128 (sec). Leaf size: 24
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-9*y(x) - exp(3*x) - sin(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 (x \right )}}{10} \]