88.9.4 problem 4

Internal problem ID [24024]
Book : Elementary Differential Equations. By Lee Roy Wilcox and Herbert J. Curtis. 1961 first edition. International texbook company. Scranton, Penn. USA. CAT number 61-15976
Section : Chapter 2. Differential equations of first order. Exercise at page 48
Problem number : 4
Date solved : Thursday, October 02, 2025 at 09:54:31 PM
CAS classification : [_linear]

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

With initial conditions

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