Resolve f(x+1)=f(x)+100

90 Views Asked by At

I have the following data:

Level xp    xp cumul
1     100   100
2     200   300
3     300   600
4     400   1000
5     500   1500
6     600   2100
7     700   2800
8     800   3600
9     900   4500
10    1000  5500

curve here

I would like a function that takes xp as a parameter (right column) and returns level (left column)

xp formula is: level*100

xp cumul formula is: (xp+1) + (xp)

1

There are 1 best solutions below

1
On BEST ANSWER

I think that you are describing the following: the amount of xp per level is $xp(l) = 100l$, so the cumulative xp gained by level $l$ will be $xp_c(l) = \sum_{n=1}^l 100n = 100 \cdot \frac{l(l+1)}{2}$, as mentioned in the comments.

In particular, I think that you are looking for $xp_c^{-1}(l)$, which will take the total amount of xp and spit out a level: to do this, consider $$x = xp_c(xp_c^{-1}(x)) = 50((xp_c^{-1}(x))^2 + xp_c^{-1}(x))$$ which gives you $$xp_c^{-1}(x) = \frac{-50 + \sqrt{2500 + 200x}}{100}$$ which you can verify passes through the points $(100, 1), (300, 2), \dots$.

If you only want integer values, just take the floor of it.