Find integral limits for step functions

algorithmscalculusintegrationreal-analysisstep function

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:

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

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

  3. $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!).

Best Answer

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)}$$