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
    Your $\frac{x}{x+5}=1-\frac{5}{x+5}$ and as $x$ gets large the $5$ in the denominator won't matter. There are many choices. They are generally called sigmoid curves, but the Wikipedia article is not very helpful.2011-03-25
  • 0
    I realize that there are many choices, and I'm sorry my question was so badly defined. Also, I don't understand the above... why is it significant that the 5 in the denominator won't matter?2011-03-25
  • 0
    I was just pointing out the similarity to $1-\frac{1}{x}$ as $x$ gets large. The $5$ does control the growth rate down near $0$, which can help.2011-03-25
  • 1
    The function which is constantly $0.9$ does not converge to $1$.2011-03-27

2 Answers 2

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
    or rather $f(x)=\arctan(x)/(\pi/2)$2011-03-25
  • 0
    You need to multiply by $\frac{2}{\pi}$ to get the desired behavior at $\infty$. Good point about polynomials.2011-03-25
  • 0
    @joriki: you are right ;-) I will edit the answer...2011-03-25
  • 0
    Duh. Edited. I last studied any kind of math about 20 years ago.2011-03-25
  • 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 growing too fast, and the first one is also undefined for x = 0, which is a problem (characters will start with no armor).2011-03-25