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

share|improve this question
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. –  Ross Millikan Mar 25 '11 at 13:21
    
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? –  Marcel Popescu Mar 25 '11 at 13:24
    
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. –  Ross Millikan Mar 25 '11 at 13:31
1  
The function which is constantly $0.9$ does not converge to $1$. –  Rasmus Mar 27 '11 at 9:45
add comment

2 Answers

up vote 0 down vote accepted

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

share|improve this answer
    
or rather $f(x)=\arctan(x)/(\pi/2)$ –  joriki Mar 25 '11 at 13:01
    
You need to multiply by $\frac{2}{\pi}$ to get the desired behavior at $\infty$. Good point about polynomials. –  Ross Millikan Mar 25 '11 at 13:01
    
@joriki: you are right ;-) I will edit the answer... –  Fabian Mar 25 '11 at 13:02
    
Duh. Edited. I last studied any kind of math about 20 years ago. –  Marcel Popescu Mar 25 '11 at 13:03
    
@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. –  Fabian Mar 25 '11 at 13:07
add comment

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

share|improve this answer
    
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). –  Marcel Popescu Mar 25 '11 at 13:20
add comment

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.