2.4.1 problem 1

Internal problem ID [704]
Book : Differential equations and linear algebra, 3rd ed., Edwards and Penney
Section : Section 1.5. Linear first order equations. Page 56
Problem number : 1
Date solved : Tuesday, September 30, 2025 at 04:06:37 AM
CAS classification : [_quadrature]

\begin{align*} y+y^{\prime }&=2 \end{align*}

With initial conditions

\begin{align*} y \left (0\right )&=0 \\ \end{align*}
Maple. Time used: 0.021 (sec). Leaf size: 12
ode:=y(x)+diff(y(x),x) = 2; 
ic:=[y(0) = 0]; 
dsolve([ode,op(ic)],y(x), singsol=all);
 
\[ y = 2-2 \,{\mathrm e}^{-x} \]
Mathematica. Time used: 0.018 (sec). Leaf size: 14
ode=y[x]+D[y[x],x] == 2; 
ic=y[0]==0; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to 2-2 e^{-x} \end{align*}
Sympy. Time used: 0.067 (sec). Leaf size: 8
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(y(x) + Derivative(y(x), x) - 2,0) 
ics = {y(0): 0} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = 2 - 2 e^{- x} \]