Find integral limits for step functions I have an equation of the form
$$f(t) + \int_0^t H(t') dt' = c$$.
For now, assume that $f(t)$ is linear, and $H(t)$ is some arbitrary step function (not necessarily just a standard heaviside step function. Is there any easy/ logical way of solving this to find the integral limit t. It feels like it should be easy, as the integral of the step function is 'just' a piecewise linear function, but I'm really struggling to do this.
While I don't have any specific values in mind, I am most interested in the following:

*

*The values of the n components of H(t) form a non-negative decreasing sequence.


*$f(t) = kt$, where $k > 0$.


*$c > 0$.
Under these conditions, I think there should be a unique solution (though would be interested to hear if I am wrong in assuming this!).
 A: Proof of existence and  uniqueness:
The solution exists because $g(t)=f(t) + \int_0^{t} H(u)du $ is a continuous function with $g(0)=0$ and $g(\frac{c}{k} +1) > c$, so by the intermediate value theorem there is at least a solution.
Now, say you have two solutions such that $t_2 > t_1$ then
$$f(t_1) + \int_0^{t_1} H(u)du = c$$
$$f(t_2) + \int_0^{t_2} H(u)du = f(t_2) + \int_0^{t_1} H(u)du +\int_{t_1}^{t_2} H(u)du  =  c$$
So subtracting  you get
$$f(t_2)-f(t_1)+\int_{t_1}^{t_2} H(u)du =0$$
But this is impossible because $ f(t_2)-f(t_1) >0$ and $\int_{t_1}^{t_2} H(u)du \geq 0$.

A method to solve the problem would be finding the component of $H(t)$ in which the solution lies and then calculate the solution from the starting point of that component. The algorithm to find the component is fast because $g(t)$ is a strictly increasing function so you can use a binary search with the values of $g(t)$ at the starting point of every component.
After you find the right component, say it starts (or the previous finishes) at $t_{a}$, you can calculate the solution exactly by just considering the difference $c-g(t_{a})$ and finding the right value in that component, which is easy because you need just to solve
$$(k+\lim_{t \to t_{a}^+}H(t))(t-t_{a}) =c-g(t_{a})$$
where $\lim_{t \to t_{a}^+}H(t)$ is the value at the starting point of the component.
So the solution is
$$t = t_a + \frac{c-g(t_{a})}{k+\lim_{t \to t_{a}^+}H(t)}$$
A: For any function $h$ (not necessarily step),
$$f(t)+\int_0^t h(t)\,dt=c$$
is
$$f(t)+H(t)-H(0)=c$$ where $H$ is an antiderivative of $h$. To obtain $t$, you solve this ordinary, univariate equation.
If $h$ is a step function, its antiderivative is piecewise linear and continuous. You can solve the equation in every piece independently (and check that the solution(s) belong to the definition interval of the piece).
If $f$ is $kt$, then $t=0$ is always a solution. There can be a second solution if the values of $h$ are larger, then smaller than $k$.
