8.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, March 04, 2025 at 11:33:19 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.007 (sec). Leaf size: 12
ode:=y(x)+diff(y(x),x) = 2; 
ic:=y(0) = 0; 
dsolve([ode,ic],y(x), singsol=all);
 
\[ y = 2-2 \,{\mathrm e}^{-x} \]
Mathematica. Time used: 0.022 (sec). Leaf size: 14
ode=y[x]+D[y[x],x] == 2; 
ic=y[0]==0; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to 2-2 e^{-x} \]
Sympy. Time used: 0.113 (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} \]