43.11.4 problem 1(d)

Internal problem ID [8954]
Book : An introduction to Ordinary Differential Equations. Earl A. Coddington. Dover. NY 1961
Section : Chapter 2. Linear equations with constant coefficients. Page 93
Problem number : 1(d)
Date solved : Tuesday, September 30, 2025 at 06:00:29 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }-y^{\prime }-2 y&=x^{2}+\cos \left (x \right ) \end{align*}
Maple. Time used: 0.004 (sec). Leaf size: 34
ode:=diff(diff(y(x),x),x)-diff(y(x),x)-2*y(x) = x^2+cos(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = {\mathrm e}^{2 x} c_2 +{\mathrm e}^{-x} c_1 -\frac {x^{2}}{2}-\frac {\sin \left (x \right )}{10}-\frac {3 \cos \left (x \right )}{10}+\frac {x}{2}-\frac {3}{4} \]
Mathematica. Time used: 0.072 (sec). Leaf size: 76
ode=D[y[x],{x,2}]-D[y[x],x]-2*y[x]==x^2+Cos[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to e^{-x} \left (\int _1^x-\frac {1}{3} e^{K[1]} \left (K[1]^2+\cos (K[1])\right )dK[1]+e^{3 x} \int _1^x\frac {1}{3} e^{-2 K[2]} \left (K[2]^2+\cos (K[2])\right )dK[2]+c_2 e^{3 x}+c_1\right ) \end{align*}
Sympy. Time used: 0.137 (sec). Leaf size: 37
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x**2 - 2*y(x) - cos(x) - Derivative(y(x), x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{1} e^{- x} + C_{2} e^{2 x} - \frac {x^{2}}{2} + \frac {x}{2} - \frac {\sin {\left (x \right )}}{10} - \frac {3 \cos {\left (x \right )}}{10} - \frac {3}{4} \]