69.17.3 problem 553

Internal problem ID [18339]
Book : A book of problems in ordinary differential equations. M.L. KRASNOV, A.L. KISELYOV, G.I. MARKARENKO. MIR, MOSCOW. 1983
Section : Chapter 2 (Higher order ODEs). Section 15.3 Nonhomogeneous linear equations with constant coefficients. Superposition principle. Exercises page 137
Problem number : 553
Date solved : Thursday, October 02, 2025 at 03:10:37 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }-y&=x +\sin \left (x \right ) \end{align*}
Maple. Time used: 0.003 (sec). Leaf size: 22
ode:=diff(diff(y(x),x),x)-y(x) = x+sin(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = {\mathrm e}^{-x} c_2 +{\mathrm e}^{x} c_1 -\frac {\sin \left (x \right )}{2}-x \]
Mathematica. Time used: 0.059 (sec). Leaf size: 72
ode=D[y[x],{x,2}]-y[x]==x+Sin[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to e^{-x} \left (e^{2 x} \int _1^x\frac {1}{2} e^{-K[1]} (K[1]+\sin (K[1]))dK[1]+\int _1^x-\frac {1}{2} e^{K[2]} (K[2]+\sin (K[2]))dK[2]+c_1 e^{2 x}+c_2\right ) \end{align*}
Sympy. Time used: 0.043 (sec). Leaf size: 19
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x - y(x) - sin(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^{x} - x - \frac {\sin {\left (x \right )}}{2} \]