Wrong answer from DSolve?

I could not verify the solution given by M either. Maple solved this and verifies the solution. But the solution is given as implicit. Here is the solution fyi in case it might help see what is the problem:

restart;
eq:=diff(u(t),t)=sqrt(u(t))+1/(n+1);
ic:=u(0)=0;
sol:=dsolve({eq,ic},u(t));

Mathematica graphics

 DEtools[remove_RootOf](sol);
-2*u(t)^(1/2)*n+t*n+2*arctanh((n+1)*u(t)^(1/2))-2*u(t)^(1/2)+
      ln(-u(t)*n^2-2*u(t)*n-u(t)+1)+t = 0

Mathematica graphics

odetest(%,eq); #verifies the solution
         (* 0 *)

You might want to report this to [email protected]. It might be that M tried to solve the implicit solution, and that where the problem is. Notice the warning messages on the console:

Inverse functions are being used by Solve, so some solutions 
may not be found; use Reduce for complete solution information

The problem is that the solution takes the other branch of the square root. Look at this:

f = u[t] /. 
  First@DSolve[{u'[t] == Sqrt[u[t]] + 1/(n + 1), u[0] == 0}, u[t], t]
fp = D[f, t]
Plot[Evaluate[{fp, Sqrt[f] + 1/(n + 1)} /. n -> 3], {t, 0, 1}]

enter image description here

Note that Mathematica warns you that some solutions may not be found.


While working with NDSolve whenever I see a square root of first order I get rid of it immediately by squaring and raising the order or power of ODE... as a Rule. It could be beneficial with DSolve also.

Better to raise the power or order of ODE rather than bring in the power of Mathematica into an otherwise easily doable reconfiguration.

c= 1/(1+n) ; u'[t] = Sqrt[u[t]] + c 

Squaring,differentiating and simplifying we get:

2 u''[t] = (1 + c/ Sqrt[u[t]])

Now eliminate Sqrt[u], throwing out all double sign problems to get a neat second

order ODE.

DSolve[{2 u''[t] == u'[t]/(u'[t]-c) , u'[0]== c, u[0]== 0}, u,t]

It may require Reduce due to inverse functions.Also it provides a handle on new

initial u'[0] variations as bonus for wider understanding of your phenomenon.

EDIT: We can take it further into analytic form based on new derivative u'[t]= y[t]:

y'[t]== y[t]/(y[t]-c)

DSolve[{2 y'[t] == y[t]/(y[t] - c)}, y, t]

{{y -> Function[{t}, -c ProductLog[-(E^(-(t/(2 c)) + C[1]/c)/c)]]}}  

whose integral you are looking for after incorporating initial value.

If closed form is not possible, a full numerical can be taken as a recourse.