How to find formula given variable limits

24 Views Asked by At

To build a javascript game, I need a function where : $$y <= x <= z\ (\text{and } y < z)$$ $$\lim_{x\to y} f(x) = 1,\ \ \lim_{x\to z}f(x) = 0$$ with $y$ and $z$ are variables limits.

I've started with $a = 1 - (x / z)$

But I don't know how to include $y$ in that formula.

2

There are 2 best solutions below

1
On BEST ANSWER

You can try this: $a={x-z\over y-z}$

2
On

What about $f(x)=\frac{x-z}{y-z}$?