Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Let's say I have a resource, call it E.

There are four important values

  1. Em - the maximum amount of E we can have
  2. Ec - the current amount of E
  3. Er - the rate at which E replenishes (this is in % of Em)
  4. Ea - the cost amount in E of an action

Let us assume that we start at max capacity.

at t=0 : Ec = Em
at t=i : Ec = (Ec at i-1) - Ea     + Er*Em
 aka   curr = previous    - action + replenish

How can I make a formula that models this behavior to determine at what t will I run out of resources.

I can make some estimates when I use values, let's say Em is 1000, Er is 0.01, and Ea is 50.

1000 / 50 = 20, so at t = 20, I will only have what I gained from my resource replenishment. 1000 * 0.01 = 10 * 20 = 200 more resources to spend. 200 / 50 = 4, so in 4 more t's, I would have acquired 40. I can estimate that between t=24 and t=25 I will run out of resources.

Estimating to within a t is acceptable, but doing it iteratively is a pain on my real datasets. I really don't remember how to turn an infinite series into a formula, so I turn to you guys.

Thanks!

share|improve this question

1 Answer 1

up vote 1 down vote accepted

As you have written the equation, you have a fixed change of $-Ea + ErEm$ per period, so it will last $\frac{Em}{Ea-ErEm}$ periods. Is this what you meant?

share|improve this answer
    
Wow. When you put it that way, that's... so simple. I feel kind of silly now. Thanks so much! –  corsiKa Mar 7 '11 at 22:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.