40.16.3 problem 10B

Internal problem ID [6794]
Book : Schaums Outline. Theory and problems of Differential Equations, 1st edition. Frank Ayres. McGraw Hill 1952
Section : Chapter 25. Integration in series. Supplemetary problems. Page 205
Problem number : 10B
Date solved : Sunday, March 30, 2025 at 11:23:00 AM
CAS classification : [_linear]

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

Maple. Time used: 0.002 (sec). Leaf size: 12
ode:=x*diff(y(x),x) = 1-x+2*y(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = x -\frac {1}{2}+c_1 \,x^{2} \]
Mathematica. Time used: 0.032 (sec). Leaf size: 16
ode=x*D[y[x],x]==1-x+2*y[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to c_1 x^2+x-\frac {1}{2} \]
Sympy. Time used: 0.299 (sec). Leaf size: 12
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(x*Derivative(y(x), x) + x - 2*y(x) - 1,0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{1} x^{2} + x - \frac {1}{2} \]