81.11.20 problem 15-19

Internal problem ID [21644]
Book : The Differential Equations Problem Solver. VOL. I. M. Fogiel director. REA, NY. 1978. ISBN 78-63609
Section : Chapter 15. Method of undetermined coefficients. Page 337.
Problem number : 15-19
Date solved : Thursday, October 02, 2025 at 07:59:23 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y-2 y^{\prime }+y^{\prime \prime }&=\left (x^{2}-1\right ) {\mathrm e}^{2 x}+\left (3 x +4\right ) {\mathrm e}^{x} \end{align*}
Maple. Time used: 0.003 (sec). Leaf size: 36
ode:=diff(diff(y(x),x),x)-2*diff(y(x),x)+y(x) = (x^2-1)*exp(2*x)+(3*x+4)*exp(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {{\mathrm e}^{x} \left (2 \left (x^{2}-4 x +5\right ) {\mathrm e}^{x}+x^{3}+4 x^{2}+2 c_1 x +2 c_2 \right )}{2} \]
Mathematica. Time used: 0.166 (sec). Leaf size: 43
ode=D[y[x],{x,2}]-2*D[y[x],x]+y[x]==(x^2-1)*Exp[2*x]+(3*x+4)*Exp[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to \frac {1}{2} e^x \left (x^3+4 x^2+2 e^x \left (x^2-4 x+5\right )+2 c_2 x+2 c_1\right ) \end{align*}
Sympy. Time used: 0.216 (sec). Leaf size: 32
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq((-3*x - 4)*exp(x) - (x**2 - 1)*exp(2*x) + y(x) - 2*Derivative(y(x), x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \left (C_{1} + x \left (C_{2} + \frac {x^{2}}{2} + 2 x - 4 e^{x}\right ) + \left (x^{2} + 5\right ) e^{x}\right ) e^{x} \]