85.7.12 problem 3

Internal problem ID [22466]
Book : Applied Differential Equations. By Murray R. Spiegel. 3rd edition. 1980. Pearson. ISBN 978-0130400970
Section : Chapter 1. Differential equations in general. A Exercises at page 32
Problem number : 3
Date solved : Thursday, October 02, 2025 at 08:40:22 PM
CAS classification : [[_linear, `class A`]]

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

With initial conditions

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