Simple asymptotic function

$\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.

$\endgroup$ 4

4 Answers

$\begingroup$

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

$\endgroup$ 1 $\begingroup$

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)$$

$\endgroup$ 5 $\begingroup$

It could also be:

$$f(x) = 1-a^x$$ with $$0<a<1$$ to control the growth rate

$\endgroup$ 1 $\begingroup$

$$f(x) = x/(x + 1)$$you can replace 1 with any larger value to slow down the change in values.
for example $f(x)=x/(x+2)$ will give you slower change in values. So you could make it dynamic, and values could change slower or faster based on some condition.

$\endgroup$

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like