50.17.23 problem 5 solved directly

Internal problem ID [8094]
Book : Differential Equations: Theory, Technique, and Practice by George Simmons, Steven Krantz. McGraw-Hill NY. 2007. 1st Edition.
Section : Chapter 4. Power Series Solutions and Special Functions. Section 4.2. Series Solutions of First-Order Differential Equations Page 162
Problem number : 5 solved directly
Date solved : Wednesday, March 05, 2025 at 05:29:45 AM
CAS classification : [[_linear, `class A`]]

\begin{align*} y^{\prime }&=x -y \end{align*}

With initial conditions

\begin{align*} y \left (0\right )&=0 \end{align*}

Maple. Time used: 0.005 (sec). Leaf size: 11
ode:=diff(y(x),x) = x-y(x); 
ic:=y(0) = 0; 
dsolve([ode,ic],y(x), singsol=all);
 
\[ y = x -1+{\mathrm e}^{-x} \]
Mathematica. Time used: 0.028 (sec). Leaf size: 13
ode=D[y[x],x]==x-y[x]; 
ic={y[0]==0}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to x+e^{-x}-1 \]
Sympy. Time used: 0.116 (sec). Leaf size: 10
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x + y(x) + Derivative(y(x), x),0) 
ics = {y(0): 0} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = x - 1 + e^{- x} \]