When explaining the math behind Mammon in Clicker Heroes, I noted that we can convert extra gold into extra damage by raising four to the power of one over the logarithm of 1.07 to the power of 25 with a base of the increased gold.
In excel or google spreadsheets, if you are storing the number you want to convert in cell X, that is
= 4^(1/LOG(X,1.07^25))
But logarithms can be neatly simplified in a number of ways. If x is the value to converted and c = 1.07 to the power of 25, the formula in this case can be simplified as follows:
Now I can set cell Y as:
=LOG(4,1.07^25)
And my formula is, instead
=X^Y
It's pretty easy to not simplify things when you have a spreadsheet doing all the work for you anyway, but calculating one constant to raise things to the power of is much better than doing all that work each time. I could be shaving literal millionths or billionths of a second off the processor time.
Don't forget to comment and thumbs up if you read this blog to see examples of simplifying logarithms!
No comments:
Post a Comment