How to solve piecewise differential equation when which branch is active depends on function value I want to solve a differential equation that is piecewise, but the conditions of the piecewise function depend on the value of the equation, ie,
$$f^\prime(x)=\cases{ c_1 & $f(x) < c_5$ \cr \frac{c_2}{c_3 + c_4x} & $f(x) \geq c_5$},$$ where $c_i$ for $i\in \{1,\ldots, 5\}$ are constants.
I wouldn't be surprised if this is standard knowledge, but I don't know the proper language to use to describe my problem, and so pointers and what to search for would be appreciated.
 A: Suppose $(x_o,y_o)$ has $y_o>c_5$ then we face 
$$\frac{dy}{dx} = c_1$$ 
which gives $y = c_1(x-x_o)$ for all $x \in \mathbb{R}$ such that $c_1x+b_1 > c_5$. If $c_1 \neq 0$ then eventually we reach the point $(x_1,y_1)$ where we change cases for the DEqn, for the solution considered, $c_5 = c_1(x_1-x_o)$ hence $x_1 = (c_5+c_1x_o)/c_1$ and we face a new problem: solve
$$ \frac{dy}{dx} = \frac{c_2}{c_3+c_4x}$$
subject the initial condition $(x_o+c_5/c_1, c_5)$. Supposing $c_4 \neq 0$ we integrate to obtain: 
$$ y = \frac{c_2}{c_4}\ln |c_3+c_4x|+b_1$$
and then you just have to choose $b_1$ such that:
$$ c_5 = \frac{c_2}{c_4}\ln |c_3+c_4(x_o+c_5/c_1)|+b_1$$
which is to say,
$$ y = \frac{c_2}{c_4}\ln \left[ \frac{|c_3+c_4x|}{|c_3+c_4(x_o+c_5/c_1)|} \right]+c_5.$$
Again, to summarize, pick a point to start. Solve the problem near that point (this puts you in one of the cases) then find when the solution intersects the other case. At that point, assume continuity to continue to solution to the other case. 
The method of Laplace transforms is also sometimes useful for piecewise discontinuous problems. In any event, the different cases for your constants might be of physical interest depending on the origin of your question. Pay attention to the cases.
