Therefore, the total income with "W" amount of worker is the sum of all these.
If we integrate on both sides we obtain a formula for the amount of minerals you have at anytime t. Make note that "W" is a function of t. The speed at which you create workers directly effects your minerals. This will pretty much always be a piece-wise function as worker production stops during the late game. So the formula is..
But! Minerals isn't only dependent on income! It also depends on how much you are spending on units and structures. For this we need an additional formula that represents the total amount you have spent on these items for any time "t." We will call this function G(t). This will ALWAYS be a piece-wise function. We also cannot forget the initial 50 minerals you start with! Therefore the complete equation is..
For an example, lets say we do not spend any resources on units or structures. Which means W(t)=6 for all t. (Since you start with 6 workers) The entire denominator can be approximated as an average time of 6.5 seconds. Of course in actuality, this time varies depending on which mineral field the worker has to gather from since each field is a different distance away from the base. We will take the total time to be a minute.
So this equation predicts minerals of 277 Adding the initial 50 minerals we obtain 327. The actual amount of minerals is 325. This discrepancy is based upon the fact that we estimated the terms in the denominator.
This doesn't do us much good considering it we tend to make workers when we play star craft! So let's say you are Terran. The build time for an SCV is 17 seconds. Therefore at t=0 you have 6 SCV's and at t=17 you have 7. (Assuming your 6 SCV's gather RIGHT when the game starts) Using these data points (0,6) and (17,7) you obtain the equation of a line.
Now technically, this should be a floor function. (Floor around the entire equation.) The reason for this is because SCV's come out in discrete units, not continuously.
To deal with this, we will need to convert the integral into a summation. I will not go into the detail of this, but here is the work. (This is very similar to using Reiman Sums!)
Is this the correct answer though? No it is not! Remember that every 17 seconds you are using up 50 minerals to make an SCV! Therefore, you do three times in a matter of 60 seconds. (Making one at 0 seconds.) Do not forget to add the initial 50 minerals, which means your G(t) is equal to 100. So your total minerals is 175. This is EXACTLY what it is in game!
In a normal star craft game, the user will typically stop making worker around 75ish, so create a piece-wise function that reflects that. Terran is the simplest example, this gets a little more tricky with Protoss as you can chrono-boost and it gets REALLY tricky when you are zerg as you aren't making drones continuously, rather in waves all at once.
Remember! As you expand, you are changing W(t)! This is because you are now creating 2 SCV's at once! (If you have two bases)
Good luck have fun!!