1.2.20 problem 22

Internal problem ID [38]
Book : Elementary Differential Equations. By C. Henry Edwards, David E. Penney and David Calvis. 6th edition. 2008
Section : Chapter 1. First order differential equations. Section 1.3. Problems at page 27
Problem number : 22
Date solved : Tuesday, September 30, 2025 at 03:39:06 AM
CAS classification : [[_linear, `class A`]]

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

With initial conditions

\begin{align*} y \left (4\right )&=0 \\ \end{align*}
Maple. Time used: 0.028 (sec). Leaf size: 13
ode:=diff(y(x),x) = y(x)-x; 
ic:=[y(4) = 0]; 
dsolve([ode,op(ic)],y(x), singsol=all);
 
\[ y = x +1-5 \,{\mathrm e}^{-4+x} \]
Mathematica. Time used: 0.015 (sec). Leaf size: 15
ode=D[y[x],x]==y[x]-x; 
ic={y[4]==0}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to x-5 e^{x-4}+1 \end{align*}
Sympy. Time used: 0.076 (sec). Leaf size: 14
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(x - y(x) + Derivative(y(x), x),0) 
ics = {y(4): 0} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = x - \frac {5 e^{x}}{e^{4}} + 1 \]