Elitist Jerks [Math] Stat Equivalence and Taylor Series

 01/05/08, 1:59 AM #31 radiante Von Kaiser   Radiante Draenei Shaman   Stormreaver The biggest problem has never been the algebra. The hard part has always been the math required to model some mechanics; Piecewise functions, stochastic methods ( for stuff like Wind Fury), integer functions (which makes them non continuous functions), etc. It will be always easier to simulate (since this is what the game is anyways) than trying to find advance maths functions that represent the game.
01/05/08, 2:44 AM   #32
Irise
Von Kaiser

Fenris
 Originally Posted by glowacks The problem with analyzing other variables is such a rigorous manner is that the gains you would gain from it you would potentially lose because you're basically assuming differentiability to the non-differentiable step-functions that arise in the game. When it comes down to it, all that matters is a proper model of your classes damage and an ability to input all your possible gear and buffs into that model and see what comes out the best. The fact that spreadsheets might list partial derivatives at the current gear state is only to help guide decisions when the spreadsheet doesn't have everything available. The power of calculus in the real world is to approximate solutions where direct calculation is unappealing; if we can use a straightforward "brute force" model that approximates things just as well as an analytical model and can calculate it just as easily, there's no point to the extended analysis.
Completely agree with everything here. I would also add that since armor is modeled logarithmically its cannot accurately modeled via only the first few terms of the taylor expansion.

There are only two cases where analysis like this would even be even remotely useful.

1. Sites such as lootzor.com - World of Warcraft search and rate items - profile your wow character and thottbot allow you to assign point value to each stat and then rank items in their database. In this case your first partials would supply the necessary coefficients.

2. The other is an amusing exercise in calculating the optimal stats for item if you fix the items level. The easiest approach to this problem is via method of Lagrange multipliers. The item level, denoted as $\ I(u)$, is calculated as $\ I(u)=((c_1u_1)^{1.5}+\dots+(c_n u_n)^{1.5})^{1/1.5}$. Then we know via Lagrange multipliers that to optimize $\ F(u)$, the gradients of $\ F(u)$ and $\ I(u)$have to point in the same direction. This is assuming of course that $\ F(u)$ is differentiable. Note that $\ I_i(u)= \frac{(c_i u_i)^0.5}{I(u)(-0.5)}$.

I am going to skip the calculations because I assume that if you have been reading thus far you know the method of Lagrange Multipliers. Now if F(u) is a linear function we find that there is an optimal weighting of stats which is fixed irrespective of ilevel. You get a similar result if F(u) is of the form $a_1 u_1^2 + ... + a_n u_n^2$.

Last edited by Irise : 01/05/08 at 3:01 AM.

01/05/08, 3:35 AM   #33
Muphrid
Don Flamenco

Gnome Mage

Stormrage
 Originally Posted by Arawethion Yeah, Mage isn't the greatest example here, since essentially everything is linear. On the other hand, it's actually simple enough to model, and since this is just about mathematical fun anyway, I guess that makes it the best candidate to mess around with.
Indeed, I feel spoiled in some way, playing a class that is so "easy" to model.

I did, however, make sure to choose an upgrade path that would yield a non-zero (though typically trivial) second-order term.

 Also, you might be interested in this: http://elitistjerks.com/f31/t14250-m...ell_selection/
Indeed! Linear programming (despite the flaw pointed out) was always a topic of interest to me.

 Originally Posted by glowacks I did a decent amount of my own multi-variable analysis of the mage damage function with the only variables being crit and damage. With a consistent talent build and base damage values, there were numbers in place of the variables other than hit and crit in your final equation. That stuff just took 3rd semester calculus to calculate, and even adding in haste or other variables into the calculation would not really change things other than the computational complexity. I abandoned work on it when I found that people had developed detailed spreadsheets for calculating damage directly instead of goign through symbolic analysis.
Indeed, the preexisting tools out there made me reject any attempt to make my own; I feel there is something to be said for symbolic solutions, at least to simple problems, so that is what I pursue. Along with lambasting Blizzard for making their system of scaling so intractable.

 The problem with analyzing other variables is such a rigorous manner is that the gains you would gain from it you would potentially lose because you're basically assuming differentiability to the non-differentiable step-functions that arise in the game.
With respect, that's an issue for the function that is being analyzed. How well an expected DPS function models real DPS is not something really related to the method by which you calculate stat equivalence.

 When it comes down to it, all that matters is a proper model of your classes damage and an ability to input all your possible gear and buffs into that model and see what comes out the best.
I think this is important: we can get away with "all possible gear and buffs" because there is a relatively small pool of possibilities. This, however, is not what Blizzard can do when balancing classes, as their pool of possibilities is with only some restrictions. Should they design the gear first and make class balance fit? That seems rather suspect. It seems clear to me they must design gear that will keep balance in check. Yet with the equations as complicated as they are, what can they do? I would imagine they are reduced to plugging in potential items that fit their itemization formula into a spreadsheet or tool (not unlike the ones we players use) and see what works.

We players have it easy in this respect. All the possibilities are determined for us.

 Originally Posted by Irise Completely agree with everything here. I would also add that since armor is modeled logarithmically its cannot accurately modeled via only the first few terms of the taylor expansion.
Does it?

Let $W(w)= \frac{1}{1+\frac{w}{w_l}}$, a model of the average multiplier on damage due to armor, with w the armor the target has and w_l the armor constant (e.g. 10557.5 for a level 70 attacker) based on the attacker's level.

A Taylor expansion...

$W(w_0+\Delta{w})= W(w_0) - \frac{w_l\Delta{w}}{(w+w_l)^2} + \frac{w_l(\Delta{w})^2}{(w+w_l)^3} - \frac{w_l(\Delta{w})^3}{(w+w_l)^4}+\cdots$
(Now that I finally have it as right as I know it...)
Since (w+w_l)^n rapidly increases, this should converge. What am I missing here?

 There are only two cases where analysis like this would even be even remotely useful. 1. Sites such as lootzor.com - World of Warcraft search and rate items - profile your wow character and thottbot allow you to assign point value to each stat and then rank items in their database. In this case your first partials would supply the necessary coefficients.
Indeed, though what I was ultimately I suppose I was trying to say that approximations of the partial derivative are what are commonly used for the first-order approximation.

For example, approximating the first partial of a hunter's dps with respect to agility by just adding 10 agility, taking the change in dps, and dividing by 10 to find the per-point effect. And, indeed, this would be a fairly good approximation, because the second-order effects are negligible at this scale and because the partial derivative would not change a whole lot on that interval.

 2. The other is an amusing exercise in calculating the optimal stats for item if you fix the items level. The easiest approach to this problem is via method of Lagrange multipliers. The item level, denoted as I(u), is calculated as I(u) = ((c_1 u_1)^{1.5) + ... + (c_n u_n)^(1.25))^(1/1.5) . Then we know via Lagrange multipliers that to optimize F(u), the gradients of F(u) and I(u) have to point in the same direction. This is assuming of course that F(u) is differentiable. Note that I_i(u) = (c_i u_i)^0.5 I(u)^(-0.5). I am going to skip the calculations because I assume that if you have been reading thus far you know the method of Lagrange Multipliers. Now if F(u) is a linear function we find that there is an optimal weighting of stats which is fixed irrespective of ilevel. You get a similar result if F(u) is of the form a_1 u_1^2 + ... + a_n u_n^2.
Well if you're dealing with very small increases in item level, yeah, the optimal gear path (in terms of direction) does not change very much. But it's not linear. As you start to consider bigger item level increases, the nonlinearity of the optimal gear path becomes very apparent, even with "linear" objective functions.

Last edited by Muphrid : 01/05/08 at 3:48 AM.

01/05/08, 4:08 AM   #34
Disquette
doop doop de doooo

Human Rogue

Sargeras
 Originally Posted by Torael_7 I would imagine that you could very easily account for any cooldown - internal or otherwise - could be modeled with the aide of a heavyside function.
Could you show how this would work? You don't have to show how any damage works. If you could just provide a calculation that shows the rate at which windfury procs, in seconds, based on independent main hand and offhand weapon speeds and flurry chances, and how to deal with proc-based haste effects to interact with this, with the formula showing the rate at which offhand windfuries and mainhand windfuries would proc, that would be a really nice addition to the shaman knowledge base. Please use a 1 roll system for white hits, and a 2 roll system for yellow hits.

I don't usually ask specific people for specific things, but since you indicated it would be easily accounted for, I'd love to see this information available to the shaman community.

http://us.battle.net/wow/en/forum/to...6766?page=3#41
Let me map a priority list out for you so that you can refer to it in the future:
1. Money 2. Money 3. PvE 4. Mages 5. Companion pets 6. PvP

 01/05/08, 5:18 AM #35 • Aldriana Mike Tyson   Aldriana Night Elf Rogue   Doomhammer Honestly, it would surprise me if you need anything that sophisticated, even for shaman mechanics. I'll take a look at it when I have some free time, although there's a few fundamental shaman mechanics that I'll need explained first. First on the list would be: if you have two weapons of the same speed, do they remain synced throughout the fight, or do flurry + haste procs manage to separate them? What about for two weapons whose speed differs by a small integer multiple (i.e, one is twice the speed of the other)? If two weapons strike simultaneously, can they both proc WF, or does one always get nailed by the cooldown of the other? Also, does it suffice to look solely at autoattack, or are there instant attacks that need to be considered as well?
01/05/08, 11:52 AM   #36
Irise
Von Kaiser

Fenris
 Originally Posted by Muphrid Let $W(w)= \frac{1}{1+\frac{w}{w_l}}$, a model of the average multiplier on damage due to armor, with w the armor the target has and w_l the armor constant (e.g. 10557.5 for a level 70 attacker) based on the attacker's level. A Taylor expansion... $W(w_0+\Delta{w})= W(w_0) - \frac{w_l\Delta{w}}{(w+w_l)^2} + \frac{w_l(\Delta{w})^2}{(w+w_l)^3} - \frac{w_l(\Delta{w})^3}{(w+w_l)^4}+\cdots$ (Now that I finally have it as right as I know it...) Since (w+w_l)^n rapidly increases, this should converge. What am I missing here?
The correct model for average multiplier on damage due to armor would be
$W(w)=\frac{1}{1+\frac{w}{w_l}}\vee 0.25$

Assuming that we are the in range that you are talking about, I can extract from your formula that
$W(w_0 + \Delta w)= \frac{w_l}{w_l + w_o} \cdot \frac{1}{1+\frac{\Delta w}{w_o +w_l}}$

The taylor expansion for this is only valid when
$|\frac{\Delta w}{w_0 + w_l}|<1$ . You are right that we will not need to worry about this since $\Delta w \leq w_0$ i.e. the amount of armor reduction applied is less than the total armor on the target. However, the closer that ratio gets to 1 the more terms you will need to take into account. If we take the limiting case for us, which would be $-\Delta w= w_0 = 3 \times w_l$ we get that
$W(w_0 + \Delta w)=\frac{1}{4} \Big( 1 - \frac{-3}{4} + (\frac{-3}{4})^2 - \dots \Big)$
We know that $W(3w_l - 3w_l)= 1$ but only taking the first two terms of the taylor expansion gives us 7/16 which is far from accurate. In this scenario we are talking about taking a boss with 30k armor and removing almost all of it which is impossible with the current game mechanics (I could be wrong since I don't play a physical dps class). But you can put in some plausible values in there to get similar discrepancies.

Edit: Actually this discussion isn't merely pedantic because if you are a warrior or paladin and are close to the armor cap then the taylor expansion would be useless for calculating how much you should value each additional point of armor.

Last edited by Irise : 01/05/08 at 1:28 PM.

01/05/08, 12:48 PM   #37
Irise
Von Kaiser

Fenris
 Originally Posted by Muphrid Well if you're dealing with very small increases in item level, yeah, the optimal gear path (in terms of direction) does not change very much. But it's not linear. As you start to consider bigger item level increases, the nonlinearity of the optimal gear path becomes very apparent, even with "linear" objective functions.
If you let $F(\vec{u})$ be an affine function then the gradient is constant hence optimal gear path does not change period.

Edit: Some what related to this, do we know what the damage distribution is like for weapons? For example if a weapon says Dmg 1-10 then are you as likely to hit for 2 damage as you are to hit for 5 damage? I feel that a place where some analysis, via some statisitical/stochastic methods, would be useful is looking at this Damage Distribution per swing of bosses. This would be useful for devs as they could fine tune the swing timers, damage distribution such that the risk of a tank dying would minimal for an appropriate healing setup.

Last edited by Irise : 01/05/08 at 12:58 PM.

01/05/08, 2:34 PM   #38
Disquette
doop doop de doooo

Human Rogue

Sargeras
 Originally Posted by Aldriana Honestly, it would surprise me if you need anything that sophisticated, even for shaman mechanics.
Yes, it has surprised everyone who has tried thusfar.

 I'll take a look at it when I have some free time, although there's a few fundamental shaman mechanics that I'll need explained first. First on the list would be: if you have two weapons of the same speed, do they remain synced throughout the fight, or do flurry + haste procs manage to separate them? What about for two weapons whose speed differs by a small integer multiple (i.e, one is twice the speed of the other)? If two weapons strike simultaneously, can they both proc WF, or does one always get nailed by the cooldown of the other? Also, does it suffice to look solely at autoattack, or are there instant attacks that need to be considered as well?
procs, parries, and flurry will desynch them.

One always invokes the WF cool down of the other.

stormstrike (1 every 10 seconds)
windfury (36% chance on each landed hit outside the 3 second cooldown from the last hit)
autoattack
flurry
haste procs

Are the things that would be involved in this (and all the things which depend on and precede them in a combat mechanics scenario).

http://us.battle.net/wow/en/forum/to...6766?page=3#41
Let me map a priority list out for you so that you can refer to it in the future:
1. Money 2. Money 3. PvE 4. Mages 5. Companion pets 6. PvP

 01/05/08, 2:37 PM #39 Muphrid Don Flamenco   Muphrid Gnome Mage   Stormrage To Irise: Regarding armor, you're right, there are times when using only the first couple terms would produce very poor approximations. But that's going to be true of many functions, not just armor, especially when you're looking at large stat changes. I personally would use Taylor expansions for two things: 1) To generate approximations for the purposes of stat equivalence 2) To derive a closed-form for ∆F. In the latter case, how quickly the expansion converges is not a huge consideration as long as it does converge. I might also note that, given this does converge... $W(w_0)= \frac{1}{1+\frac{w_0}{w_l}} = \frac{w_l}{w_0+w_l} \Rightarrow W(w_0 + \Delta{w}) = W(w_0)\frac{1}{1+\frac{\Delta{w}}{w_0+w_l}}$ Dividing W(w_0) out neatly yields the percentage increase in damage due to a change in armor (duh). I'm still...uncertain if there are any notational precedents for such a relative difference (delta is nice for absolute differences, but relative...I'm not sure). As far as capping goes, stat caps can be enforced on the domain instead of on the function, or you could use an intermediate function on raw armor w that would then be one of the variables for the damage taken function. In these cases, ∆W would tell you what you want: that there is no change in damage taken. Could you demonstrate how any of the relevant functions could be modeled as affine functions? I'm not very familiar with the math of that. Finally, to my knowledge, spells and swings deal damage that is the arithmetic mean of the min and max values. This can be easily verified with weapons: the stated dps should be just the arithmetic mean divided by the swing time.
01/05/08, 3:22 PM   #40
Rob
Paid \$25 To Raid

Draenei Shaman

 Originally Posted by Disquette (for Aldriana) stormstrike (1 every 10 seconds) windfury (36% chance on each landed hit outside the 3 second cooldown from the last hit) autoattack flurry haste procs Are the things that would be involved in this (and all the things which depend on and precede them in a combat mechanics scenario).
To add to that, Stormstrike can proc either a MH or OH Windfury (if outside the 3s cooldown). Our current assumption is that the MH is given precedence. I do not recall if this was born out by further investigation. Additionally, Stormstrike uses only one roll to determine if both weapons hit. Each weapon then gets an independent crit roll. (This is the way the rogue attack Mutilate works.) Remember that WF and SS crits will set the Flurry stack to 3 charges.

I'm posting this here rather than sending a PM in case anyone else is looking at this problem as well.

01/05/08, 3:46 PM   #41
PSGarak
Bald Bull

Hyjal
 Originally Posted by Disquette Yes, it has surprised everyone who has tried thusfar.
It's a self-fulfilling prophecy. The only people who try are the ones who can't see the complexity ahead of time. Speaking for myself, I've worked with step functions enough to never voluntary try another one if I can avoid it, and the complexity is not at all surprising =P. I expect UR uptime as a function of weapon speed to be a literally chaotic function (although not necessarily in the realm of real weapons, 1.3 to 3.8) If you're a real purist you can just raid with a 3.9 speed two-hander and know your DPS analytically (except during bloodlust...). There might be an inflection point at 1.95-speed but I think it's for the worse, not for the better.

01/05/08, 4:32 PM   #42
Irise
Von Kaiser

Fenris
[quote=Muphrid;592045] As far as capping goes, stat caps can be enforced on the domain instead of on the function, or you could use an intermediate function on raw armor w that would then be one of the variables for the damage taken function. In these cases, ∆W would tell you what you want: that there is no change in damage taken. [quote] Stat caps can always be enforced on the doman via a new boundary. This boundary is usually simple if your function was of one variable like in our case but gets complicated quickly if you increase the number of variables.

 Originally Posted by Muphrid Could you demonstrate how any of the relevant functions could be modeled as affine functions? I'm not very familiar with the math of that.
Affine function is a very fancy of saying
$F{\vec{u})= c + a_1 u_1 + \dots + a_n u_n$

 Originally Posted by Muphrid Finally, to my knowledge, spells and swings deal damage that is the arithmetic mean of the min and max values. This can be easily verified with weapons: the stated dps should be just the arithmetic mean divided by the swing time.
The mean of any symmetric distribution is the arithmetic mean of the lower and upper limit but what I am interested in is the distribution itself.

For example, say the damage done by Morrogrim is uniformly distributed between 5000 and 9000 with a swing timer of of 2.5 seconds and parry chance of 5%. Then every 2.5 seconds there is $0.05 \times \frac{1}{(9-5)^2} \times \iint_{14\leq x+y \leq 18} dx\, dy= 0.025$ chance that the tank will take a 14,000+ hit on a swing (+parry).

The same situation with normal distribution, N(7000, 600), has a much lower chance of a 14,000+ hit. To be exact
$0.05 \times \frac{1}{2 \pi \cdot 600}\iint_{14000\leq x+y} \exp ((x-7000)^2/1200) \cdot \exp ((y-7000)^2/1200) dx\, dy << 0.025$

I don't worry about these things because I assume that Blizzard devs look at this kind of stuff when designing bosses and mechanics. I would be curious though as to what kind of distribution they use.

01/05/08, 4:56 PM   #43
Muphrid
Don Flamenco

Gnome Mage

Stormrage
 Originally Posted by Irise Stat caps can always be enforced on the doman via a new boundary. This boundary is usually simple if your function was of one variable like in our case but gets complicated quickly if you increase the number of variables.
Granted. I'll have to ponder the consequences of that.

 Affine function is a very fancy of saying $F{\vec{u})= c + a_1 u_1 + \dots + a_n u_n$
Right; I guess I meant that I didn't see how even simple objective functions or the itemization formula could be modeled as affine functions.

One could rewrite the expected damage/cast function of a spell as...

$E(\vec{u})= u_h u_q (u_m + u_r u_d) (1 + u_b u_c)$

The variables multiply each other; does that not make it hairy?

 The mean of any symmetric distribution is the arithmetic mean of the lower and upper limit but what I am interested in is the distribution itself. ... I don't worry about these things because I assume that Blizzard devs look at this kind of stuff when designing bosses and mechanics. I would be curious though as to what kind of distribution they use.
Ah, of course. That would be fairly interesting. I imagine, if you desired to test it, you could find some weapons with a wide damage range.

 01/05/08, 9:28 PM #44 Machinator Don Flamenco   Berserkr Troll Warrior   Aggramar I have always seen spreadsheets abstractly as just a computer program(sometimes literally) or formula just expanded onto a grid. In each there is a way to simplify but there are a minimum number of variables that you have to keep. I started with simple sheets for my warlock which is relatively simple. Once I made my warrior I was amazed at not only many variable there were, but how they were all interconnected. I am highly skeptical that a formula would be any simpler or any more of an approximation than a spreadsheet. Also of both formula and sheet that it could account for things such as rage starvation/saturation without a simulator, similar to the shaman windfury problems. "Information is ammunition."

 Elitist Jerks [Math] Stat Equivalence and Taylor Series