Determine Time to Fill Container I'm trying to determine the formula to determine how long until a destination container is filled by other source containers. I understand the process of determining time based on flow rate, but run into an issue if the source containers are filled with different levels.
Imagine a tank, destination, has a total capacity of $1,000L$. It is being fed by $5$ other containers, filled with $50L, 100L, 100L, 200L$, and an infinite source. Each source has an equal flow rate of $2L/min$.
How do I calculate when destination will be full, in minutes? I understand the concept that the total flow rate will change as each source tank empties, but not sure how to capture that in a formula.
 A: Building on Matthew’s comment, the piecewise function would like like so
$$\left\{\begin{matrix}
t \leq 25 & f=10\\ 
25<t\leq50 & f=8\\
50<t\leq100 & f=4\\
t>100 & f=2 \\
\end{matrix}\right.$$
where $f$ is flow rate in L/min. If you sum the first three intervals, you get $$
(25*10)+(25*8)+(50*4) = 650$$
The first three intervals take a total of 100 minutes.
From here on out, the only source left is he infinite source which supplies 2 L/min. So we just calculate how much more water we need 
$$1000-650 = 350L$$
And divide by $2$ to arrive at our answer of $175$ minutes. Plus our $100$ minutes that have already elapsed, the total time $t$ is $275$ minutes
A: For the question how to sum it up in a equation:
$$1000=2 \cdot \mathbb{1}_{0\leq t \leq 25} \cdot t + 50\cdot\mathbb{1}_{t> 25}+4\cdot\mathbb{1}_{0 \leq t \leq 50}\cdot t+200\cdot \mathbb{1}_{t>50}+2\cdot \mathbb{1}_{0 \leq t\leq 100}+200\cdot\mathbb{1}_{t>100}+2 t$$
Where $\mathbb{1}_A(t)$ is the indicator function, and is equal to $1$ if $t\in A$, and $0$ otherwise. But that's not really how you should approach this problem. You'd rather want to see what's happening at what intervals of time. Divide whole process in 4 intervals: $[0, 25)$, $[25, 50)$, $[50, 100)$, $[50, \infty)$.
