15.12.8 problem 8

Internal problem ID [3152]
Book : Differential Equations by Alfred L. Nelson, Karl W. Folley, Max Coral. 3rd ed. DC heath. Boston. 1964
Section : Exercise 20, page 90
Problem number : 8
Date solved : Tuesday, March 04, 2025 at 04:03:37 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

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