I'm trying to simulate a water tank. The dynamic of the system should be described by:
DSolve[{y'[x] == Piecewise[{{-Sqrt[y[x]], 0 < y[x]}}, 0.], y[0] == 10}, y[x], x]
An infinite object ComplexInfinity might occur if you look at the -Sqrt[y[x]] term outside of 0 < y[x], however that branch should never be active under this condition.
So i don't under stand why Mathematica looks at those branches of the general solution where it is unable to compute the limit at the given points.
EDIT: Imposing the real number constraint gives the same solution as Daniel Huber however this solution stops when tank is empty. I want the solution to be Piecewise[{{1/4 (40 - 4 Sqrt[10] x + x^2), x < 2*Sqrt[10]}}, 0]
.
How can i convince Mathematica to solve this problem in a way that gives me a constant solution after the water ran out of tank?
( I'm running Mathematika 11.3 )