25 August, 2009

Calculus & FFXI -- INT and MAB

It has been long known to Black Mages that resists aside, Magic Attack Bonus, or MAB for short, is the stat that you want to focus on when it comes to raising your nuke damage. However, it is also known that for lower tier nukes, INT adds more damage than MAB.

Out of this comes the question of when the transition period is, and thus there is a need to relate the two together.

Today, a fairly common rule of thumb is that “2INT ≈ 1MAB,” which has been largely shown to be true from general observation.

However, I have not yet come across any mathematical support for this statement.

As advanced warning, there is a decent amount of math involved, which brings about two issues—first, not everyone likes math, so I’ll have to step away from the mathematics from time to time to explain what is going on. In addition, I have no idea what kind of math background my reader, you, would have.

To be safe, I am going to write for someone who has a high school background in Calculus, or someone in their freshman year in college.

Bear in mind that the mathematics detailed below will not necessarily make you a better player, nor will unveil some great profound secret that will change the way you look at nukers forever. It is simply an insight into the logic and reasoning that goes behind our decisions.

By providing mathematical support for the claim, not only do we get absolute, logical proof that the relation holds true (under certain circumstances), but we can verify its accuracy, and if need be, further refine the rule.

But in all honesty, I was bored. Very, very bored. ^^

By the way, if the equations don't display properly, your browser is probably blocking the HTML or Java script that takes the code and turns it into equations.

The damage formula
To begin, let’s start with the damage formula (D) for a nuke:


The equation above has a several variables, so I’ll briefly explain each component.
  • k is the product of all the modifiers you get from elemental staves, day of the week, weather, magic burst, and type of mob.
  • M refers to your total Magic Attack Bonus from both Job traits and equipment.
  • B is the spell’s base damage, which can be looked up elsewhere.
  • λ is the nuke’s tier-modifier, again, further details can be found elsewhere.
  • I refers to total Intelligence (again, base INT and gear)- the subscript Y or M tells you whose INT the equation is referring to- You, or the Mob.
For more information, you can look at its FFXIclopedia entry here.

MAB is divided by 100 and added to 1 to signify that MAB is a percentage bonus. If you have a total of 32 Magic Attack Bonus, then your MAB multiplier is 1.32.

Model limitations
Bear in mind that this equation is not entirely accurate because of limitations in the computation, which is a topic that is usually touched upon in college under Numerical Analysis.

Because a computer can’t store an infinite number of decimal places, it has to truncate the working figure at some point, which means it just ignores all the numbers after a certain position.

For example, if you were to multiply 1.4 and 3.7 together, but your calculator could only store one number after the decimal point, your calculator would give you the answer, 5.1, instead of the real answer, which is 5.18. Because the calculator cannot store any more numbers past the 1, the 8 is lost through the truncation process.

In Final Fantasy XI’s case, all the numbers that go into the damage formula are truncated down to their integer values, and so because of this, our calculated values from the equation above will have a little bit of error in it.

Once again, the equation for calculating your damage is,


The typical textbook question here would ask you to maximize your damage.

Notice that this question by itself does not make sense, because the answer would just be to make your Intelligence and Magic Attack Bonus infinitely large. The unspoken fine print is to find the maximum value of D within some kind of boundary, which would represent the gear selection currently available. This is a topic typically covered in a college freshman math course in multivariable calculus.

Still, the question is not very interesting because you can just go out there and try different gear sets yourself, or just plug in numbers to compare. The problem is easily solved by just going out there and testing it yourself, without having to actually using college mathematics to do so.

What is more interesting is the relationship between INT and MAB, which will help when evaluating gear choices, or to better understand in what proportions of INT and MAB work well together. Are Vicious mufflers better than Yigit gages? What if SE produced a pair of gloves that added +9INT? Which is best?

Because we want to find out how much INT we need to make up for 1MAB, we need to first determine the increase in damage by changing INT and MAB. Hence, we need to differentiate.

The first stumbling block is that the function has multiple variables. Most, if not all of the functions up until high school calculus involve only one variable, so what do you know when there are two?

Let’s re-examine what the differentials actually mean.

Taking the derivative with respect to MAB as an example, it refers to the change in damage with respect to your Magic Attack Bonus. In other words, how much would my damage change if I increased my MAB by 1?

This may sound familiar to those who have studied basic microeconomic theory, in particular, marginal costs and/or marginal benefits. In this case, the marginal benefit of hiring a new employee refers to the benefit (profit) gained as a result of hiring one more employee, and changing nothing else.

Likewise, what we are looking at here is the marginal benefit of adding 1 MAB.

The key here is that the only thing you are changing is your MAB, therefore everything else can be treated as a constant!

This is called the partial derivative, and is used in functions with more than one variable. The idea is, how much change would I expect by increasing this variable while holding all other variables constant?

Because we are only interested in the relationship between I_Y and MAB, we only need to compute the derivates with respect to those two variables.

Also note that it does not make sense to compute the derivative to any of the other variables, because they are just outside our control.

So, if


I can differentiate this using the product rule, but I personally prefer to just expand the brackets and rearrange to get

\[D=\left [\frac{k(B- \lambda I_M)}{100} \right ]M+\frac{\lambda kMI_Y}{100} +k \lambda I_Y+k(B- \lambda I_M) \]

So, in order to take the partial derivative of D with respect to MAB, I assume everything except MAB is constant.

Thus, taking the partial differential with respect to MAB, I get:

\[\frac{\partial D}{\partial M}=\frac{k(B- \lambda I_M)}{100}+\frac{\lambda kI_Y}{100} \]
\[\frac{\partial D}{\partial M}=\frac{k[B+ \lambda (I_Y-I_M)]}{100} \]

Likewise, taking the partial differential with respect to your INT,

\[\frac{\partial D}{\partial I_Y}=\frac{\lambda kM}{100}+\lambda k\]
\[\frac{\partial D}{\partial I_Y}=\frac{\lambda k(M+100)}{100}\]

Thus, I now have a say of calculating the amount of change my damage will incur if I change either my intelligence, or my MAB.

Back to the question!
Going back to the original question, I want to know how much intelligence I have to add in order to match MAB. In other words, I want to know when the two partial derivatives are equal. In particular, I want to know how much intelligence I need to add (remember, that’s just dD/dI) when dD/dM is 1.

Using the principle of small changes, I can write:
\[\frac{\triangle I_Y}{\triangle M}\approx\frac{\partial I_Y}{\partial M}\]

In this case, ∆MAB=1, so
\[\triangle I_Y\approx\frac{\partial I_Y}{\partial M}\]

Finally, using the chain rule, I can now deduce an expression to find the change in I_Y with respect to MAB.

\[\frac{\partial I_Y}{\partial M}=\frac{\partial I_Y}{\partial D}\frac{\partial D}{\partial M}\]

\[\triangle I_Y\approx\frac{\partial I_Y}{\partial M}=\frac{100}{\lambda k(M+100)}\frac{k[B+\lambda(I_Y-I_M)]}{100}\]

\[\triangle I_Y\approx\frac{\frac{B}{\lambda}+I_Y-I_M}{M+100} \]

Voila! We now have an equation to calculate the amount of I_Y required to match 1MAB’s worth of damage.

Notice that MAB is found on the denominator, which indicates as MAB increases, less INT will be required to match that increase in damage. In other words, as your MAB increases, raising INT will become more and more damage-efficient.

Using the formula
To use the formula, pick a nuke and look up the required values. For example, let’s assume I’m nuking Thunder IV, which has a base damage of 541 and a tier modifier of 2, on an Ebony Pudding (89INT). I have 125INT and a total of 71MAB, including my Job Trait Magic Attack Bonus, so plugging those numbers into the equation, I get:

\[\triangle I_Y\approx\frac{\frac{B}{\lambda}+I_Y-I_M}{M+100}=\frac{\frac{541}{2}+125-89}{71+100}=1.792 \]

So I need roughly 1.8INT in order to match 1MAB’s worth of damage. Pretty close to the 2INT=1MAB claim!

Note that this number obviously varies from person to person, depending on that player's own stats, so if you want, you could quickly go through the calculation yourself to find your own INT:MAB ratio, but it should be quite close to the 9:5 ratio as suggested here.

Edit (16th April 2010): (Finally) got rid of those equation borders...only about 8 months late. :P
Edited to clarify some things pointed out by Robonosto.


solanis said...

Awesome post.

Robonosto said...

This is really good support for such rules of thumb and a good way to illustrate how changes to the magic damage function work.

However, later claims hamper your fine work, particularly your assertion that your work illustrates that MAB "has diminishing returns" is ludicrous (to be blunt) after having invoked differential calculus and economics concepts. It is easy to fashion some sophistry that "INT has diminishing returns," too. So what?

First, the concept of rate of return can be described as a rate of change of output (damage in this case) with respect to some input, be it INT or MAB. The partial derivatives presented here describe the rate of return (with respect to some input) and diminishing return refers to a decreasing rate of return. Percent changes have nothing to do with this.

If you disagree with all this, there is no point in reading further.

Second, as you have already shown, the rate of change of damage with respect to MAB does not depend on MAB. In contrast, the rate of change of damage with respect to INT does depend on (current) MAB.

Consequently, changes in INT become more efficient (with respect to increasing damage) as MAB increases, whereas the efficiency of MAB is the same regardless of MAB level.

Your final derived expression demonstrates that changes in INT become more efficient with increasing MAB, not that "MAB has diminishing returns."

Tuufless said...


Good point- thanks for picking that up. I'll admit that the end part was rather rushed, so not as clearly thought out as the rest of the post. I'll probably have to rewrite and edit that last bit now, heh.

Anonymous said...

The images created for the equations are inserted as img elements with class="mathimg". So you should be able to make the borders disappear by just defining how img.mathimg is supposed to look in your .css files.

Matthew said...

I'm actually in Calc 3 studying partial derivatives at the moment. The question you answer here is one of the questions that inspired me to study mathematics in the first place.

It's amazing to see what I'm learning and how it can be used come together in such a fun way~! Thanks.

Anonymous said...