75.5.3 problem 3

Internal problem ID [19951]
Book : A short course on differential equations. By Donald Francis Campbell. Maxmillan company. London. 1907
Section : Chapter IV. Ordinary linear differential equations with constant coefficients. Exercises at page 58
Problem number : 3
Date solved : Thursday, October 02, 2025 at 05:04:25 PM
CAS classification : [[_2nd_order, _with_linear_symmetries]]

\begin{align*} y^{\prime \prime }-4 y^{\prime }+2 y&=x \end{align*}
Maple. Time used: 0.002 (sec). Leaf size: 30
ode:=diff(diff(y(x),x),x)-4*diff(y(x),x)+2*y(x) = x; 
dsolve(ode,y(x), singsol=all);
 
\[ y = {\mathrm e}^{\left (2+\sqrt {2}\right ) x} c_2 +{\mathrm e}^{-\left (-2+\sqrt {2}\right ) x} c_1 +\frac {x}{2}+1 \]
Mathematica. Time used: 0.014 (sec). Leaf size: 41
ode=D[y[x],{x,2}]-4*D[y[x],x]+2*y[x]==x; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to \frac {x}{2}+c_1 e^{-\left (\left (\sqrt {2}-2\right ) x\right )}+c_2 e^{\left (2+\sqrt {2}\right ) x}+1 \end{align*}
Sympy. Time used: 0.117 (sec). Leaf size: 31
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x + 2*y(x) - 4*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 \left (2 - \sqrt {2}\right )} + C_{2} e^{x \left (\sqrt {2} + 2\right )} + \frac {x}{2} + 1 \]