# Calculator: Vampire Growth

If vampires create more vampires, how long would it take for them to take over the world?
If Buffy kills vampires, at what rate would she need to kill them to preserve the balance?
Would vampires go extinct? Would Buffy prevail? Does she even have a chance?!
If there are, right now, vampires that can sire others.
And each of them creates vampires
But Buffy slays vampires per
And there are vampires immigrating to Sunnydale every
Then, after
there will be xx vampires
The calculation is inspired by the growth equation:

Final population of vampires = StartingPopulation * eGrowthFactor * Time

However, we calculate the results per day, in incremental steps, so using the exponential function makes no sense. Instead, we break it apart:

For each day, we check whether we reached the timeframe for either vampires siring others, buffy eliminates vampires, or vampires are immigrating in.

If we reach the timeframe for either, we add or remove accordingly:

• For vampire growth, when the number of days is reached, we add a multiplication of the population growth: population = population + ( population * vampiresEachSires )
• For Buffy's slaying, when the number of days is reached, we remove however many vampires she's slain: population = population - slainVampires
• For vampire immigration, when the number of days is reaced, we add the number of arriving vampires: population = population + newVampires

The combined result, per day, is the stored and presented in the graph.

## Thanks, Credits, and Corrections

It's super exciting to see the awesome reception for this tool!

A number of people have pointed out some bugs and errors in the code or calculations that resulted in changes:

• The initial calculation was ovredoing the exponentiation, and the results appeared exaggerated. This was fixed.
Thanks a bunch to Lee Biernbaum for noticing!
• Inputs had a bad way of falling-back if there was no data, which basically made choosing 0 impossible. This was fixed.
Huge thank you to Jeffrey Lovitz for finding this and submitting a pull request!
• Added a string representation of numbers of ten to make big numbers understandable. Thanks to @krainboltgreene for the idea! (Also, to Joe Matazzoni and Alex Ezell who suggested a similar feature)