Elitist Jerks

Elitist Jerks (http://elitistjerks.com/forums.php)
-   Class Mechanics (http://elitistjerks.com/f31/)
-   -   [Math] Stat Equivalence and Taylor Series (http://elitistjerks.com/f31/t19640-math_stat_equivalence_taylor_series/)

Muphrid 01/04/08 3:01 AM

[Math] Stat Equivalence and Taylor Series
 
Theorycrafters spend no small amount of effort on the computation of how much of one stat is equivalent to some specific amount of another, at least in terms of some objective function. However, most of the approaches used are brute-force numeric methods; though most are sound, they are nevertheless approximations. This post will merely demonstrate why these approximations work for small stat changes, in addition to more exact symbolic solutions (that, granted, are also more difficult to work with).

Let us, then, consider some objective function F as a function of all stats and effects \vec{u}. Note that while F is a scalar function, \vec{u} is a vector. In one sense, calling \vec{u} a vector is doing so a bit loosely, but let's go with it.

Now, the idea of computing stat equivalence is based on some original starting point, which we can call \vec{u}_0. We can then call the changes from that point (in terms of stats, procs, etc.) \Delta{\vec{u}}.

What's relevant for the purposes of a stat comparison is a function...

\Delta{F}(\vec{u}) = F(\vec{u}) - F(\vec{u}_0)

Where \vec{u} = \vec{u}_0 + \Delta{\vec{u}}.

A Taylor series expansion would be helpful here: indeed, we can see that everything after the zeroth-order term in a Taylor expansion would neatly yield the value of the function \DeltaF.

However, this is, quite obviously, a multivariable Taylor series. As such it can be written in multi-index notation...

\Delta{F}(\vec{u}) = \sum_{|\vec{\alpha}| \ge 1}\frac{\partial^{\vec{\alpha}}F(\vec{u})}{\vec{\alpha}!}\Delta{\vec{u}}^{\vec{\alpha  }}

Where the notation is consistent with Wikipedia's page on multi-index notation.

I personally prefer something based more on the concept of tensors:

\Delta{F}(\vec{u}) = \sum_{n \ge 1}^{\infty}\frac{F^{\left ( n \right )}(\vec{u})}{n!}\bullet\left(\Delta{\vec{u}}\right)^{n}

Where F^{\left ( n \right )}(\vec{u}) denotes the nth derivative (as a gradient, hessian, and subsequently higher rank tensors), and \Delta{\vec{u}}^{n} \equiv \underbrace{\Delta{\vec{u}} \otimes \Delta{\vec{u}} \otimes \cdots \otimes \Delta{\vec{u}}}_n and \left ( \bullet \right ) stands for the Hadamard product of tensors, which is, in some ways, a generalization of dot product in terms of multiplying corresponding entries of two tensors together.

It should be noted that there are very few functions (that I can think of, anyway) that would have derivatives higher than second-order for any single stat, and for the most part, anything beyond the first-order could be ignored--in essence, this is the foundation for most approximations we see: linear approximations of the function \Delta{F}.

An Example: Damage and Crit for Casters

At any rate, this is all a bit esoteric, so perhaps it's good to see an example in practice:

Consider an expected damage/cast function E(\vec{u}) = hq(m+rd)(1+bc). In considering a simple example, most of the variables are irrelevant; we'll only look at a two-variable case, where \Delta{\vec{u}} = \Delta{d}\hat{d} + \Delta{c}\hat{c} (which represent a change in +damage and crit chance, respectively).

In this case, all we need to calculate \Delta{E} is...

\Delta{E}(\vec{u}_0+\Delta{\vec{u}}) = E^{\prime}\bullet\Delta{\vec{u}} + \frac{1}{2}E^{\prime\prime}\bullet(\Delta{\vec{u}}\otimes\Delta{\vec{u}})

Since only two variables are changing, we can imagine that this is just a function of two-variables. This is just a cosmetic shortcut: in truth, all we're doing is ignoring irrelevant parts of the gradient (and hessian, and so on) that have to do with variables that aren't changing--that is, with elements that, when put through the Hadamard product, are just going to be multiplied with elements that are zero and won't contribute to the sum.

Thus...

\begin{align} E^{\prime} &= \begin{bmatrix} hq(1+bc)r & hq(m+rd)b \end{bmatrix} \\ E^{\prime\prime} &= \begin{bmatrix} 0 & hqbr \\ hqbr & 0 \end{bmatrix} \\ \Delta{\vec{u}} &= \begin{bmatrix} \Delta{d} & \Delta{c} \end{bmatrix} \\ \Delta{\vec{u}}\otimes\Delta{\vec{u}} &= \begin{bmatrix} (\Delta{d})^2 & \Delta{d}\Delta{c} \\ \Delta{d}\Delta{c} & (\Delta{c})^2 \end{bmatrix} \\ \\ E^{\prime}\bullet\Delta{\vec{u}} &= hq(1+bc)r\Delta{d} + hq(m+rd)b\Delta{c} \\ \frac{1}{2}E^{\prime\prime}\bullet(\Delta{\vec{u}}\otimes\Delta{\vec{u}}) &= hqbr\Delta{d}\Delta{c} \end{align}

Which yields...

\Delta{E}(\vec{u}_0+\Delta{\vec{u}}) = hq(1+bc)r\Delta{d} + hq(m+rd)b\Delta{c} + hqbr\Delta{d}\Delta{c}

Which is exactly what an algebraic expansion would tell you. The benefit, of course, is that this method can be used when algebra would fail.

Application to Stat Equivalence

In terms of stat equivalence, the power of this symbolic method can lead to vast generalizations.

Using the function above, it's pretty easy to show that...

\begin{align} \Delta{E}(\vec{u}_0 + \Delta{d}\hat{d}) &= hq(1+bc)r\Delta{d} \\ \Delta{E}(\vec{u}_0 + \Delta{c}\hat{c}) &= hq(m+rd)b\Delta{c}\end{align}

Using these expressions, we can set the two equal and thus see how much \Delta{d} +damage is equivalent to a given amount of crit chance, \Delta{c} or vice versa.

That is, setting the two expressions equal...

\begin{align} hq(1+bc)r\Delta{d} &= hq(m+rd)b\Delta{c} \\ \Delta{d} &= \frac{\frac{m}{r}+d}{\frac{1}{b}+c}\Delta{c}\end{align}

Which can be converted to raw stats just by considering the rating conversion from crit chance to rating. And the expression can be solved in reverse to find how much crit chance is needed to be equivalent to a given amount of +damage.

These are, however, among the simpliest possible expressions imaginable. Once more than one spell in rotation is considered, they grow much more complicated. It is for this reason that the symbolic generalizations are terribly limited.

Kaubel 01/04/08 7:02 AM

I can still kick your ass.

Chuo 01/04/08 7:26 AM

You got me on the first equation... not good at maths :O

Bolche 01/04/08 8:11 AM

Quote:

Originally Posted by Muphrid (Post 590634)
These are, however, among the simpliest possible expressions imaginable. Once more than one spell in rotation is considered, they grow much more complicated. It is for this reason that the symbolic generalizations are terribly limited.

I think you've said it all ! ;-)

You just can't transform everything to a simple F function. For exemple the warlock dps calculation leads to a differential equation (you need X mana/s to cast your spells -> Y lifetaps to cover it -> you spend some time lifetaping -> you need X2 mana/s -> ...).

But essentially, why bother with complicated (leading to unsolvable ?) equations, when you just can calculate F(\vec{u}) and F(\vec{u}_0) and thus find \Delta{F}(\vec{u}) ?

Merple 01/04/08 9:36 AM

I don't even know how to use the math systems here at EJ, but I'm wondering if I was the only person whose first response to this post was to post something along the lines of ...


I wish I understood the math behind half of the things that go on in this game or at least _what_ math is behind it, but I can’t even fathom it.
Damn you, arts background.

SeanDamnit 01/04/08 11:42 AM

I dare you to post this on the official forums.

Uglesh 01/04/08 11:57 AM

Was I the only person who quickly scrolled to the bottom of his post when I saw he was using a function F and a vector u to make sure I didn't waste 5 minutes reading that his equation would wind up being some math nerd joke?? I was just waiting to see variables C or K.

Oh i'll never forgive my algebra teacher for that wonderful "= R D R R "

Delita 01/04/08 12:19 PM

eh, F and u are pretty common. F is the general function notation and u can be the x component of a vector or more commonly a vector itself defined by the i, j and k directions. But no, I did the same thing ><'.

Ozzmar 01/04/08 12:28 PM

Quote:

Originally Posted by Uglesh (Post 591015)
Oh i'll never forgive my algebra teacher for that wonderful "= R D R R "

I guess my algebra teacher never explained that one to us... Care to enlighten the ignorant? :)

andastra 01/04/08 12:33 PM

Quote:

Originally Posted by Ozzmar (Post 591072)
I guess my algebra teacher never explained that one to us... Care to enlighten the ignorant? :)


I think it's meant to be read "Hardy Har Har".

Tinweasele 01/04/08 1:14 PM

If you would be so kind as to post a key for your "simple" equation that would be nice.

Muphrid 01/04/08 1:32 PM

Quote:

Originally Posted by Bolche (Post 590766)
I think you've said it all ! ;-)

You just can't transform everything to a simple F function. For exemple the warlock dps calculation leads to a differential equation (you need X mana/s to cast your spells -> Y lifetaps to cover it -> you spend some time lifetaping -> you need X2 mana/s -> ...).

It's interesting you say that; what the series shows is that you don't need to know the original function to calculate the change in DPS. You only need the first and subsequent derivatives.

Quote:

But essentially, why bother with complicated (leading to unsolvable ?) equations, when you just can calculate F(\vec{u}) and F(\vec{u}_0) and thus find \Delta{F}(\vec{u}) ?
It's really just more of a reminder that most ways of computing stat equivalence rely on some approximation of what is ultimately this Taylor series. A simple way to calculate the value of a stat compared to another might be to consider how much dps 1 of each stat gives and just use a linear approximation to project how much dps an arbitrary amount of those stats would yield. Indeed, many stats are linear, and thus this is exact. Some stats, however, are not linear--resilience and agility, for example. Any combination of linear stats is not linear but second-order. Granted, in both cases, the second-order terms are typically negligible for small stat changes, but it does help to remember than in such cases, it is an approximation, and it does get progressively worse as larger stat changes are considered.

But, even a simple spreadsheet can outperform such an analysis for all practical purposes. Beyond being a theoretical curiosity, though, the Taylor expansion--and the utter intractability of even most simple functions when expanded--tells me one thing: that Blizzard haven't a clue what they're doing. It's their job to balance classes not just now but at a wide range of gear levels. I didn't even get into optimization over a given boundary curve (which would be the item point allocation function), but it's clear it would be nigh on impossible to do.

Quote:

Originally Posted by Tinweasele (Post 591163)
If you would be so kind as to post a key for your "simple" equation that would be nice.

How do you mean?

PSGarak 01/04/08 3:33 PM

I think he means identifying the variables h, \, q, \, m, \, r, \, d, \, b, and c in your equation. Looks to me like hit, haste, base damage, coefficient, damage from gear, crit damage bonus, and crit chance respectively.

Question: Why you are using a fully multivariable Taylor product instead of just taking partial derivatives with respect to various variables? It seems to me that the reason you would use the more complex operation, the interaction between various partials, is immediately being ignored when you ignore the complicated parts of the formula. In fact, taking the partials of E(\vec{u}) = hq(m+rd)(1+bc)with respect to b and c and setting up a ratio gives the exact same result, \frac{(\frac{m}{r}+d)}{(\frac{1}{b}+c)}, in this case. Under what circumstances would this not be the case?

Also regarding your initial hypotheses: proc-based uptimes (like flurry and improved shadowbolt) tend to have n-order polynomial sections, where n is the number of charges on the proc, 3 and 4 in those cases, so there are cases with very important higher-order derivatives. I'm trying to come up with exponential or logarithmic functions and can't, but I wouldn't be surprised to see exponential decay towards a cutoff.

EDIT: Apparently on forums $ does not automagically create LaTeX formatting -_-.

Muphrid 01/04/08 4:31 PM

Quote:

Originally Posted by PSGarak (Post 591380)
I think he means identifying the variables h, \, q, \, m, \, r, \, d, \, b, and c in your equation. Looks to me like hit, haste, base damage, coefficient, damage from gear, crit damage bonus, and crit chance respectively.

Yeah, only difference being q represents flat damage multipliers instead of haste--this being a damage per cast (and not a DPS) function.

Quote:

Question: Why you are using a fully multivariable Taylor product instead of just taking partial derivatives with respect to various variables? It seems to me that the reason you would use the more complex operation, the interaction between various partials, is immediately being ignored when you ignore the complicated parts of the formula. In fact, taking the partials of E(\vec{u}) = hq(m+rd)(1+bc)with respect to b and c and setting up a ratio gives the exact same result, \frac{(\frac{m}{r}+d)}{(\frac{1}{b}+c)}, in this case. Under what circumstances would this not be the case?
I'm not sure I understand what you mean.

\begin{align}\frac{\partial{E}}{\partial{b}} &= hq(m+rd)c \\ \frac{\partial{E}}{\partial{c}} &= hq(m+rd)b \end{align}

The ratio is just \frac{b}{c} or its inverse.

How is "just taking partial derivatives" different from the Taylor series as a whole?

Quote:

Also regarding your initial hypotheses: proc-based uptimes (like flurry and improved shadowbolt) tend to have n-order polynomial sections, where n is the number of charges on the proc, 3 and 4 in those cases, so there are cases with very important higher-order derivatives. I'm trying to come up with exponential or logarithmic functions and can't, but I wouldn't be surprised to see exponential decay towards a cutoff.

EDIT: Apparently on forums $ does not automagically create LaTeX formatting -_-.
I would be highly, highly surprised if Blizzard had anything remotely resembling exponential growth or decay in any of their mechanics. They don't seem to be that smart.

I think ultimately any theoretical model of such effects will be too woefully simplistic. You need an average rate of consumption to compare against the rate of reapplication.

Sepulture 01/04/08 5:09 PM

Quote:

Originally Posted by SeanDamnit (Post 590985)
I dare you to post this on the official forums.

You really should. You should also provide a link. The entertainment value would be priceless.


All times are GMT -4. The time now is 10:21 PM.

Forum Infrastructure by vBulletin 3.6.12 ©2000-2007, Jelsoft Enterprises Ltd.