Need help creating a special function

43 Views Asked by At

I'm creating a special function in a game and needed some help with the maths end of it.

Essentially, I need a programmable, non-linear function so that $f(100) = 0$, and $f(0) = 100$ (or some other number, I'd have to play around with this). Every value in between approaches $f(0)$ as they get smaller (i.e $f(30)$ could be something $\sim85$).

It needs to be non-linear and increase with each decreasing value of $x$.

Thanks in advance for any help!

1

There are 1 best solutions below

0
On

In the comments you mentioned that a linear function will also work. This is the simplest kind of function you can use. There is only one linear function satisfying your requirements, and that is: $f(x)=100-x$