2

Excuse me I've not been in a math class for over 15 years, I'm new to Mathematics stack exchange so hopefully someone can help me refine my question. I'm writing a program in C# and I have this simple equation to figure out what level a character is based on how much XP they have. To get the level of a character that has 5000 XP, I use this. XP^.17 is my static formula for figuring out a player's level.

$x = 5000^.17$

So x = 4.2543 rounded down, the players level is level 4. So that is simple for me to understand.

However I need to program a function that can find the characters XP needed to get to there next level. Given the players current level is 4.2543, how much XP is needed for the player to be level 5? How do I simplify this equation so that it can be solved?

$5 = x^.17$

Caimen
  • 121

5 Answers5

3

In the above equation raise both left and right hand sides to the power $\frac1{0.17}$. Then you get $$(x^{0.17})^\frac1{0.17}=x=5^{1/0.17}$$

Andrei
  • 37,370
1

You need not simplify it anymore, by raising both sides to the power of 1/0.17 (taking the 0.17th root basically), you get x, and by subtracting the current value of xp from x, you get how much more is needed in order to level up.

0

Let your current XP be $x$ and $L_x$ be your current level.

Then you have defined $$ L_x := \lfloor x^{0.17} \rfloor. $$

So if $L_x=n$, then we want to find the minimum $y$ such that $L_y=n+1$.

That is you want $y$ such that, $$y^{0.17}=n+1 \\ \implies y=(n+1)^{\frac{1}{0.17}}.$$

Then the needed XP is simply $(n+1)^{\frac{1}{0.17}}-x$.

0

Alternative approach:

$\displaystyle 5 \leq x^{.17} \implies e^{\ln 5} \leq e^{.17 \times \ln x} \implies $

$\displaystyle \ln(5) \leq .17 \times \ln(x) \implies $

$$\displaystyle \frac{\ln(5)}{.17} \leq \ln(x). \tag1 $$

You can either apply (1) above directly, or you can infer that

$$e^{\frac{\ln(5)}{.17}} \leq e^{\ln(x)} \implies $$

$$5^{\left(\frac{1}{.17}\right)} \leq x.$$

user2661923
  • 35,619
  • 3
  • 17
  • 39
0

When you see

$$a^x = b$$

and want to find $x$, you need to apply logarithms:

$$x = \log_a(b)$$

But when you see

$$x^a = b$$

and want to find $x$, you need to apply roots:

$$x = \sqrt[a]{b}$$

which is perhaps more unifyingly written as

$$x = b^{1/a}$$

.

How do you program that? Use whatever your coding language does for raising to $0.17$, only raise to $1/0.17$.