87.1.17 problem 22

Internal problem ID [23229]
Book : Ordinary differential equations with modern applications. Ladas, G. E. and Finizio, N. Wadsworth Publishing. California. 1978. ISBN 0-534-00552-7. QA372.F56
Section : Chapter 1. Elementary methods. First order differential equations. Exercise at page 9
Problem number : 22
Date solved : Thursday, October 02, 2025 at 09:24:38 PM
CAS classification : [[_linear, `class A`]]

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