Given an arbitrary (sorted) set of numbers $\{c_1,\dots,c_n\}$, define for each number the piecewise continuous linear function $$ f_i(x) =\begin{cases} x & 0\leq x\leq c_i \\ 0 & otherwise \end{cases} $$

I'm interested in the value $x$ such that $\sum_{i}f_i(x) = \max_{c\in \mathbb{R}}\sum_{i}f_i(c)$.

Now I know I can design a simple algorithm for doing so, by simply searching through the sums of different values of $c_i$ since they are sorted.

I'm interested in using differentiable functions that approximate these piecewise linear functions, so that I can look at the derivative of the sum of these approximate functions and more analytically define the critical point.