0
$\begingroup$

(I have seen this question but it is too complicated for my needs, and my math skills are not good enough to convert the answer.)

I am writing a game and I need a way to increase the armor of the character in a meaningful way: I want the increase in armor to mean a decrease in damage taken (meaning an increase in damage absorbed), approaching but never reaching 100% absorption. In other words, I need a simple, polynomial function f(x) so that $\lim\limits_{x \to \infty} f(x) = 1$ (x will never be less than zero.)

Of course, the question has trivial answers, like f(x) = 0.9; I need a non-trivial one, preferably one where f(x) grows faster at first and then "slows down".

[Edit] Removed the polynomial requirement... duh!

[Edit] I found something stupidly simple... $x / (x + 5)$ This is close enough to my requirements. Unfortunately, I have absolutely no idea how to allocate the "solution" checkmark, so I'll pick the responder with less points, and add a +1 to the other. I hope it won't create problems.

  • 1
    The function which is constantly $0.9$ does not converge to $1$.2011-03-27

3 Answers 3

1

Is polynomial important? Because polynomials will never have this behavior. Do you allow for rational functions? Or even more general ones. An obvious choice would be $f(x)=\frac{2}{\pi}\arctan(x)$

  • 0
    @Marcel Popescu: you see there are many functions which fit your requirements so you could even get more specific about how "fast" it should grow in the beginning and "fast" is should slow down.2011-03-25
2

How about $1-\frac{1}{x}$? Or $1-\exp(-x)$? Does either one meet your needs?

  • 0
    These were growi$n$g too fast, a$n$d the first one is also undefined for x = 0, which is a problem (characters will start with no armor).2011-03-25