67.2.39 problem Problem 18(d)

Internal problem ID [13925]
Book : APPLIED DIFFERENTIAL EQUATIONS The Primary Course by Vladimir A. Dobrushkin. CRC Press 2015
Section : Chapter 4, Second and Higher Order Linear Differential Equations. Problems page 221
Problem number : Problem 18(d)
Date solved : Monday, March 31, 2025 at 08:18:17 AM
CAS classification : [[_2nd_order, _exact, _linear, _nonhomogeneous]]

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

Maple. Time used: 0.002 (sec). Leaf size: 38
ode:=(-x^2+1)*diff(diff(y(x),x),x)+(1-x)*diff(y(x),x)+y(x) = -2*x+1; 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {\left (c_1 +2\right ) \left (-1+x \right ) \ln \left (-1+x \right )}{4}-\frac {\left (c_1 -2\right ) \left (-1+x \right ) \ln \left (x +1\right )}{4}+c_2 x +\frac {c_1}{2}-c_2 \]
Mathematica. Time used: 0.664 (sec). Leaf size: 235
ode=(1-x^2)*D[y[x],{x,2}]+(1-x)*D[y[x],x]+y[x]==1-2*x; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \frac {\exp \left (\int _1^x\frac {3 K[1]+1}{2 \left (K[1]^2-1\right )}dK[1]\right ) \left (\int _1^x-\frac {\exp \left (\int _1^{K[3]}\frac {3 K[1]+1}{2 \left (K[1]^2-1\right )}dK[1]\right ) (2 K[3]-1) \int _1^{K[3]}\exp \left (-2 \int _1^{K[2]}\frac {3 K[1]+1}{2 \left (K[1]^2-1\right )}dK[1]\right )dK[2]}{(K[3]-1) \sqrt {K[3]+1}}dK[3]+\int _1^x\exp \left (-2 \int _1^{K[2]}\frac {3 K[1]+1}{2 \left (K[1]^2-1\right )}dK[1]\right )dK[2] \left (\int _1^x\frac {\exp \left (\int _1^{K[4]}\frac {3 K[1]+1}{2 \left (K[1]^2-1\right )}dK[1]\right ) (2 K[4]-1)}{(K[4]-1) \sqrt {K[4]+1}}dK[4]+c_2\right )+c_1\right )}{\sqrt {x+1}} \]
Sympy
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(2*x + (1 - x)*Derivative(y(x), x) + (1 - x**2)*Derivative(y(x), (x, 2)) + y(x) - 1,0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
NotImplementedError : The given ODE Derivative(y(x), x) - (-x**2*Derivative(y(x), (x, 2)) + 2*x + y(x) + Derivative(y(x), (x, 2)) - 1)/(x - 1) cannot be solved by the factorable group method