87.4.20 problem 31

Internal problem ID [23286]
Book : Ordinary differential equations with modern applications. Ladas, G. E. and Finizio, N. Wadsworth Publishing. California. 1978. ISBN 0-534-00552-7. QA372.F56
Section : Chapter 1. Elementary methods. First order differential equations. Exercise at page 37
Problem number : 31
Date solved : Thursday, October 02, 2025 at 09:28:36 PM
CAS classification : [_linear]

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

With initial conditions

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