7.11.2 problem 2

Internal problem ID [323]
Book : Elementary Differential Equations. By C. Henry Edwards, David E. Penney and David Calvis. 6th edition. 2008
Section : Chapter 2. Linear Equations of Higher Order. Section 2.5 (Nonhomogeneous equations and undetermined coefficients). Problems at page 161
Problem number : 2
Date solved : Tuesday, March 04, 2025 at 11:08:08 AM
CAS classification : [[_2nd_order, _with_linear_symmetries]]

\begin{align*} y^{\prime \prime }-y^{\prime }+2 y&=3 x +4 \end{align*}

Maple. Time used: 0.002 (sec). Leaf size: 35
ode:=diff(diff(y(x),x),x)-diff(y(x),x)+2*y(x) = 3*x+4; 
dsolve(ode,y(x), singsol=all);
 
\[ y = {\mathrm e}^{\frac {x}{2}} \sin \left (\frac {\sqrt {7}\, x}{2}\right ) c_2 +{\mathrm e}^{\frac {x}{2}} \cos \left (\frac {\sqrt {7}\, x}{2}\right ) c_1 +\frac {3 x}{2}+\frac {11}{4} \]
Mathematica. Time used: 0.023 (sec). Leaf size: 56
ode=D[y[x],{x,2}]-D[y[x],x]+2*y[x]==3*x+4; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \frac {3 x}{2}+c_2 e^{x/2} \cos \left (\frac {\sqrt {7} x}{2}\right )+c_1 e^{x/2} \sin \left (\frac {\sqrt {7} x}{2}\right )+\frac {11}{4} \]
Sympy. Time used: 0.358 (sec). Leaf size: 39
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-3*x + 2*y(x) - Derivative(y(x), x) + Derivative(y(x), (x, 2)) - 4,0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \frac {3 x}{2} + \left (C_{1} \sin {\left (\frac {\sqrt {7} x}{2} \right )} + C_{2} \cos {\left (\frac {\sqrt {7} x}{2} \right )}\right ) e^{\frac {x}{2}} + \frac {11}{4} \]