Whats the inverse of this equation please

Levels.CalculateExpForLevel = function(Level)
    return (((Level * 50) + 50) / 2) * Level
end

if it helps this is the pattern it outputs

 Level           Exp
    1               50  -- +50
    2               150 -- +100
    3               300 -- +150
    4               500 -- +200
    5               750 -- +250

I tried for quite a while, couldn’t crack it :frowning:

1 Like

With some punching the quadratic formula gives you Level = (sqrt(4*Exp+ 25) - 5) / 10
Other one is Level = -(sqrt(4*Exp+ 25) + 5) / 10

I haven’t done this since grade 12 so don’t quote me. Looks right in a graphing calculator.

3 Likes

exp = level * 1/2 * ((level * 50) + 50)
2exp = level * ((level*50) + 50)
2exp = level^2 * 50 + level * 50
2exp = 50 * (level^2 + level)
2exp / 50 = level^2 + level
0 = level^2 + level - 2exp/50

Solve as quadratic. Using quadratic formula:

we get:

-2(2exp / 50) / 1 +/- sqrt(1^2 - 41(-2exp/50))

(-4/50 * exp) / 1 +/- sqrt(1 - -8exp/50)
(-4/50 * exp) / 1 +/- sqrt(8exp/50 + 1)

Of the two results, we choose minus because we need to cancel out the negative in the numerator (otherwise resulting level will be negative)

(-4/50 * exp) / 1 - sqrt(8exp/50 + 1)
(-12.5 * exp) / 1 - sqrt (exp/25 + 1)

Level = -12.5exp / (1 - sqrt(exp/25 + 1))

2 Likes

D’oh! qqt991 beat us by a minute.

Level = (sqrt(4 * EXP + 25) - 5) / 10

For future reference of the lazy, Wolfram Alpha has an inverse function calculator.

3 Likes