8.4.15 problem 15

Internal problem ID [718]
Book : Differential equations and linear algebra, 3rd ed., Edwards and Penney
Section : Section 1.5. Linear first order equations. Page 56
Problem number : 15
Date solved : Tuesday, March 04, 2025 at 11:34:00 AM
CAS classification : [_separable]

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

With initial conditions

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

Maple. Time used: 0.007 (sec). Leaf size: 14
ode:=2*x*y(x)+diff(y(x),x) = x; 
ic:=y(0) = -2; 
dsolve([ode,ic],y(x), singsol=all);
 
\[ y = \frac {1}{2}-\frac {5 \,{\mathrm e}^{-x^{2}}}{2} \]
Mathematica. Time used: 0.025 (sec). Leaf size: 20
ode=2*x*y[x]+D[y[x],x] == x; 
ic=y[0]==-2; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \frac {1}{2}-\frac {5 e^{-x^2}}{2} \]
Sympy. Time used: 0.311 (sec). Leaf size: 14
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(2*x*y(x) - x + Derivative(y(x), x),0) 
ics = {y(0): -2} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \frac {1}{2} - \frac {5 e^{- x^{2}}}{2} \]