81.14.17 problem 18-30

Internal problem ID [21702]
Book : The Differential Equations Problem Solver. VOL. I. M. Fogiel director. REA, NY. 1978. ISBN 78-63609
Section : Chapter 18. Algebra of differential operators. Page 435
Problem number : 18-30
Date solved : Thursday, October 02, 2025 at 08:00:08 PM
CAS classification : [[_2nd_order, _with_linear_symmetries]]

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