Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I am making a game where you want a skill value to modify some in game values. With a scale that goes from half to double. 50% to 200%. If I'd do it linear 125% will be the centre but I want the centre to be 100%.

I want a mathematical function:

  • Where I input and number from 0 to 100.
  • And get out a number from 0.5 to 2 or from 50% to 200%.
  • The function maps 0 to 0.5.
  • The function maps 50 to 1.
  • The function maps 100 to 2.
  • And I would like it to follow a logarithmic scale.
  • I do not care what happens outside the specified range.

I have made this Google Docs document which shows my plan B.

I hope someone out there can help me this has been a mathematical problem that has bugged me for years.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

If $x$ is your input between $0$ and $100$, then $2^{\left(\frac{x}{50}-1\right)}=\exp(\frac{\ln 2}{50}x-1)$ will range from $.5$ to $2$ as specified.

share|improve this answer
    
I'm testing it now. –  Ole Martin Gjersvik Dec 14 '11 at 17:33
    
Thank you it was just what I wanted. –  Ole Martin Gjersvik Dec 14 '11 at 17:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.