Question: Where is error in solving for constant of integration in this ode?

Could someone be able to spot why I get different solution when solving for the constant of integration from this Maple dsolve solution manually than when asking Maple to do it directly?

This is the ode 

ode:=x*y(x)*diff(y(x), x) = (x + 1)*(y(x) + 1);
ic:=y(1) = 1;

If I ask Maple to solve it with the IC all at once, it gives solution which odetest verifies OK.

If I ask Maple to solve it with no IC, then solve the constant myself and plug the constant back into the solution I get solution which does not verify any more.

I am not able to find why. Could someone spot the error in this? Please see worksheet below. I suspect the problem is when plugging back the constant of integration into the general solution, but have no idea now what it is. Clearly Maple did something much smarter than what I did by just plugging the constant back into the solution. May be need to specify what branch to use when plugging the constant back? but how do I know which one?
 

interface(version);

`Standard Worksheet Interface, Maple 2024.0, Windows 10, March 01 2024 Build ID 1794891`

Physics:-Version()

`The "Physics Updates" version in the MapleCloud is 1730 and is the same as the version installed in this computer, created 2024, April 17, 19:33 hours Pacific Time.`

ode:=x*y(x)*diff(y(x), x) = (x + 1)*(y(x) + 1);
ic:=y(1) = 1;
sol_no_IC:=dsolve(ode);
 

x*y(x)*(diff(y(x), x)) = (x+1)*(y(x)+1)

y(1) = 1

y(x) = -LambertW(-exp(-x-1)/(x*c__1))-1

sol_with_IC_direct:=dsolve([ode,ic]);
odetest(sol_with_IC_direct,[ode,ic]);

y(x) = -LambertW(-1, -2*exp(-x-1)/x)-1

[0, 0]

#this verifies Maple found correct constant also:

solve(rhs(sol_with_IC_direct)=rhs(sol_no_IC),c__1)

1/2

#now solve for constant of integration manually. This gives invalid solution. Why?

eq:= 1=limit(rhs(sol_no_IC),x=1);

1 = -LambertW(-exp(-2)/c__1)-1

PDEtools:-Solve(eq,c__1);

c__1 = 1/2

sol_with_ic:=eval(sol_no_IC,%)

y(x) = -LambertW(-2*exp(-x-1)/x)-1

odetest(sol_with_ic,[ode,ic]);

[0, 2+LambertW(-2*exp(-2))]

 

 

Download why_wrong_solution.mw

Please Wait...