42.2.4 problem Example 3.21

Internal problem ID [8806]
Book : THEORY OF DIFFERENTIAL EQUATIONS IN ENGINEERING AND MECHANICS. K.T. CHAU, CRC Press. Boca Raton, FL. 2018
Section : Chapter 3. Ordinary Differential Equations. Section 3.3 SECOND ORDER ODE. Page 147
Problem number : Example 3.21
Date solved : Tuesday, September 30, 2025 at 05:52:42 PM
CAS classification : [[_2nd_order, _with_linear_symmetries]]

\begin{align*} y^{\prime \prime }-2 y^{\prime }-3 y&=3 x +1 \end{align*}
Maple. Time used: 0.003 (sec). Leaf size: 21
ode:=diff(diff(y(x),x),x)-2*diff(y(x),x)-3*y(x) = 3*x+1; 
dsolve(ode,y(x), singsol=all);
 
\[ y = {\mathrm e}^{3 x} c_2 +{\mathrm e}^{-x} c_1 -x +\frac {1}{3} \]
Mathematica. Time used: 0.009 (sec). Leaf size: 28
ode=D[y[x],{x,2}]-2*D[y[x],x]-3*y[x]==3*x+1; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to -x+c_1 e^{-x}+c_2 e^{3 x}+\frac {1}{3} \end{align*}
Sympy. Time used: 0.105 (sec). Leaf size: 19
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-3*x - 3*y(x) - 2*Derivative(y(x), 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^{3 x} - x + \frac {1}{3} \]