17.1.14 problem 2(d)

Internal problem ID [4104]
Book : Theory and solutions of Ordinary Differential equations, Donald Greenspan, 1960
Section : Chapter 2. First order equations. Exercises at page 14
Problem number : 2(d)
Date solved : Tuesday, September 30, 2025 at 07:02:54 AM
CAS classification : [_linear]

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

With initial conditions

\begin{align*} y \left (-1\right )&=-1 \\ \end{align*}
Maple. Time used: 0.007 (sec). Leaf size: 14
ode:=x*diff(y(x),x) = x+y(x); 
ic:=[y(-1) = -1]; 
dsolve([ode,op(ic)],y(x), singsol=all);
 
\[ y = \left (\ln \left (x \right )+1-i \pi \right ) x \]
Mathematica. Time used: 0.015 (sec). Leaf size: 16
ode=x*D[y[x],x]==x+y[x]; 
ic=y[-1]==-1; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to x (\log (x)-i \pi +1) \end{align*}
Sympy. Time used: 0.093 (sec). Leaf size: 12
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(x*Derivative(y(x), x) - x - y(x),0) 
ics = {y(-1): -1} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = x \left (\log {\left (x \right )} + 1 - i \pi \right ) \]