I have a problem where a car enters a tunnel at one rate, and leaves the tunnel at another.
$$ v_{enter}$$ $$ v_{exit}$$
The car travels at some rate while its in the tunnel before it leaves.
$$v_{inside}$$
I was wondering, if I wanted to calculate the number of cars in the tunnel at any point in time, if the following equation would be correct:
$$\frac{d[number of cars]}{dt} = v_{enter} - v_{exit} \times \frac{v_{exit}}{v_{inside}}$$
You don't care about the speed that the cars travel, you just care about the rate of cars passing a given point. If the rate of entry is $r_{entry}$ and the rate of exit is $r_{exit}$ you have $$\frac{d[number of cars]}{dt} = r_{enter} - r_{exit}$$