56.27.3 problem Ex 3

Internal problem ID [14222]
Book : An elementary treatise on differential equations by Abraham Cohen. DC heath publishers. 1906
Section : Chapter VII, Linear differential equations with constant coefficients. Article 50. Method of undetermined coefficients. Page 107
Problem number : Ex 3
Date solved : Thursday, October 02, 2025 at 09:26:52 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }+y&=2 \,{\mathrm e}^{x}+x^{3}-x \end{align*}
Maple. Time used: 0.002 (sec). Leaf size: 21
ode:=diff(diff(y(x),x),x)+y(x) = 2*exp(x)+x^3-x; 
dsolve(ode,y(x), singsol=all);
 
\[ y = \sin \left (x \right ) c_2 +\cos \left (x \right ) c_1 +x^{3}+{\mathrm e}^{x}-7 x \]
Mathematica. Time used: 0.115 (sec). Leaf size: 25
ode=D[y[x],{x,2}]+y[x]==2*Exp[x]+x^3-x; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to x^3-7 x+e^x+c_1 \cos (x)+c_2 \sin (x) \end{align*}
Sympy. Time used: 0.042 (sec). Leaf size: 22
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x**3 + x + y(x) - 2*exp(x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{1} \sin {\left (x \right )} + C_{2} \cos {\left (x \right )} + x^{3} - 7 x + e^{x} \]