PDA

View Full Version : 3rd Ed Need math formula to calculate Level from XP



Shadow Wizard
2023-12-16, 12:29 PM
I have been searching all over, and just can't find it, and am not enough of a math guy to figure it out myself.
I need to be able to put an experience point value into a formula, and have it spit out a level, according to the 3.5 chart.
Examples:
I give it "0" it outputs 1.
I give it "10000" it outputs 5.
I gave it "55000" it outputs 11.
I understand that (please mind any math errors. the general gist is there)
If I give it "500", it will output 0.5
and if I give it "4500" it will output 3.5
and so forth. I can deal with the decimal in my programming, I just need to be able to convert an experience point value to a level (or fraction there of) for my program.

Seerow
2023-12-16, 12:53 PM
I have been searching all over, and just can't find it, and am not enough of a math guy to figure it out myself.
I need to be able to put an experience point value into a formula, and have it spit out a level, according to the 3.5 chart.
Examples:
I give it "0" it outputs 1.
I give it "10000" it outputs 5.
I gave it "55000" it outputs 11.
I understand that (please mind any math errors. the general gist is there)
If I give it "500", it will output 0.5
and if I give it "4500" it will output 3.5
and so forth. I can deal with the decimal in my programming, I just need to be able to convert an experience point value to a level (or fraction there of) for my program.

Instead of a formula, why not use a Switch/Case statement? It feels like that would be the easiest solution if you're doing actual programming. Or a vlookup if you're making an excel sheet.

Tzardok
2023-12-16, 12:56 PM
After deriving the formula for calculating the number of XP necessary to reach a level from the table, and reversing it, I've have arrived at the following formula:

lvl. = sqrt (xp / 500 + 0.25) + 0.5

Edit: forget it. There's an error in there somewhere.

Edit: Nope. It's correct.

Shadow Wizard
2023-12-16, 04:22 PM
After deriving the formula for calculating the number of XP necessary to reach a level from the table, and reversing it, I've have arrived at the following formula:

lvl. = sqrt (xp / 500 + 0.25) + 0.5

Edit: forget it. There's an error in there somewhere.

Edit: Nope. It's correct.

Thank you.

Bohandas
2023-12-16, 10:42 PM
Related question:

Is there a calculator app out there that can solve algebra problems?

Like where I would put in "y=(x^2+x)/2" and it would output "x=(((8y+1)^(1/2))-1)/2" (I think this solution is correct)

edit:
related, I think the level formula is properly ((√((8×XP÷1000)+1)−1)÷2)+1

EDIT:
NVM they're the same formula in different terms

Tzardok
2023-12-17, 04:02 AM
The Website WolframAlpha (https://www.wolframalpha.com/) can do that and a whole lot more. I use it only rarely (when I remember it exists :smallwink:) and it's a lot easier to use on PC than mobile, but it is pretty good.

Incidentally, could you explain how you arrived at your version of the formula? I can't quite get my head around it.

Chronos
2023-12-17, 08:26 AM
Any such formula must have a step where you're using a round(), floor(), or ceiling() function, because the output can only be an integer level, never a fraction.

Bohandas
2023-12-17, 09:49 AM
The Website WolframAlpha (https://www.wolframalpha.com/) can do that and a whole lot more. I use it only rarely (when I remember it exists :smallwink:) and it's a lot easier to use on PC than mobile, but it is pretty good.

Incidentally, could you explain how you arrived at your version of the formula? I can't quite get my head around it.

I realized that the XP total at each level was a triangular number (https://en.wikipedia.org/wiki/Triangle_number) multiplied by 1000, so I divided both sides of the equation by 1000 and plugged that into a termial root formula (https://en.wikipedia.org/wiki/Triangular_number#Triangular_roots_and_tests_for_t riangular_numbers) I got off of wikipedia, the aforementioned "(((8y+1)^(1/2))-1)/2"

EDIT:
And then after graphing it in Desmos I realized that it was off by 1 because levels start at 1 instead of zero so I added the +1 at the end

Tzardok
2023-12-17, 10:24 AM
Ah, I get it. I started by realizing that the amount of xp needed to reach level x is the sum of natural numbers from 1 to (x - 1) multiplied by thousand (which is apparantly the triangular number at the position of x - 1), so I looked up what that sum is (n * (n +1) / 2) and put that into the formula:

xp = x * (x - 1) / 2 * 1,000 = 500 * (x2 - x)

and then solved the equation for xp.