89.8.19 problem 21

Internal problem ID [24479]
Book : A short course in Differential Equations. Earl D. Rainville. Second edition. 1958. Macmillan Publisher, NY. CAT 58-5010
Section : Chapter 4. Additional topics on equations of first order and first degree. Exercises at page 66
Problem number : 21
Date solved : Thursday, October 02, 2025 at 10:41:22 PM
CAS classification : [[_homogeneous, `class C`], _rational, [_Abel, `2nd type`, `class A`]]

\begin{align*} x +y-4-\left (3 x -y-4\right ) y^{\prime }&=0 \end{align*}

With initial conditions

\begin{align*} y \left (4\right )&=1 \\ \end{align*}
Maple. Time used: 0.216 (sec). Leaf size: 42
ode:=x+y(x)-4-(3*x-y(x)-4)*diff(y(x),x) = 0; 
ic:=[y(4) = 1]; 
dsolve([ode,op(ic)],y(x), singsol=all);
 
\[ y = \frac {x \operatorname {LambertW}\left (\frac {2 \left (x -2\right ) {\mathrm e}^{\frac {4}{3}+2 i \pi \_Z1}}{3}\right )-2 x +4}{\operatorname {LambertW}\left (\frac {2 \left (x -2\right ) {\mathrm e}^{\frac {4}{3}+2 i \pi \_Z1}}{3}\right )} \]
Mathematica. Time used: 2.254 (sec). Leaf size: 192
ode=(x+y[x]-4 )-(3*x-y[x]-4 )*D[y[x],x]==0; 
ic={y[4]==1}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ \text {Solve}\left [-\frac {2^{2/3} \left (x \left (-\log \left (\frac {2-x}{y(x)-3 x+4}\right )\right )+x \log \left (-\frac {x-y(x)}{y(x)-3 x+4}\right )+y(x) \left (\log \left (\frac {2-x}{y(x)-3 x+4}\right )-\log \left (-\frac {x-y(x)}{y(x)-3 x+4}\right )+1+\log (2)\right )-3 x-x \log (6)+x \log (3)+4\right )}{9 (x-y(x))}=\frac {1}{9} 2^{2/3} \log (x-2)+\frac {1}{27} \left (7\ 2^{2/3}-4\ 2^{2/3} \log (2)+3\ 2^{2/3} \log \left (\frac {7}{3}\right )-4\ 2^{2/3} \log (3)-3\ 2^{2/3} \log \left (\frac {7}{2}\right )+4\ 2^{2/3} \log (6)\right ),y(x)\right ] \]
Sympy
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(x - (3*x - y(x) - 4)*Derivative(y(x), x) + y(x) - 4,0) 
ics = {y(4): 1} 
dsolve(ode,func=y(x),ics=ics)
 
ValueError : Couldnt solve for initial conditions