7.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 : Saturday, March 29, 2025 at 04:27:03 PM
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,ic],y(x), singsol=all);
 
\[ y = x +1-5 \,{\mathrm e}^{-4+x} \]
Mathematica. Time used: 0.022 (sec). Leaf size: 15
ode=D[y[x],x]==y[x]-x; 
ic={y[4]==0}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to x-5 e^{x-4}+1 \]
Sympy. Time used: 0.135 (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 \]