Creating a rational function with specific parameters

38 Views Asked by At

For a game I made, tetris, the blocks must go faster and faster every level,

I want the speed to be $500$ at level $1$, and $+-250$ at level $6$

($500$ means, $1$ block is moving down per $500$ $ms$)

So, $f(6) = 250$ and $f(1) = 500$

Keep in mind, there is an horizontal asymptote, $x = 120$, it must never go under the $120$

I've been trying to do this correctly but I'm not much experienced in mathematics. Can anyone help?

1

There are 1 best solutions below

0
On BEST ANSWER

If I understand your question correctly, you want something that goes through the points $(6,250)$ and $(1,500)$, while staying above a value of 120. If you're fine with piecewise functions, a point-slope approach gives you a function $$ f(x) = \begin{cases} -50x + 550 & \text{if}\ x\leqslant 8.6, \\ 120 & \text{if}\ x>8.6. \end{cases} $$ If you do not want a piecewise funtion, then an exponential function $ae^{-x}+120$ will approximate what you want, namely $$ g(x) = 470.925 \cdot e^{-0.215\cdot x}+120. $$ I found the values of $a$ and $b$ using Solve in Mathematica. To get a slightly more accurate result, use \begin{align*} a & = 470.9248905123606, \\ b & = 0.2145273604529698. \end{align*}