24.1.9 problem 2(c)

Internal problem ID [4198]
Book : Elementary Differential equations, Chaundy, 1969
Section : Exercises 3, page 60
Problem number : 2(c)
Date solved : Tuesday, March 04, 2025 at 05:55:34 PM
CAS classification : [_linear]

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

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