Creating an exponential function limited to a range

270 Views Asked by At

I'm trying as part of an algorithm to make a function so as to adjust dynamically a parameter of the algorithm (the cooldown rate) based on the current temperature (again in terms of the algorithm).

The temperature starts off at $k$ and continuously decreases all the way to $1$. The temperature decreases according to a cooldown rate.

What I want is when the temperature is high for the cooldown rate to be around $0.0001$ so that it cools down faster, and when the temperature is low it should cooldown much more slowly like $0.000001$. So I want a function that will give the cooldown rate at any given temperature point.

$$f(current_t)=\cdots$$

I want the function to behave exponentially like so:

graph

Yet I'm struggling on how to write that function. I know I will have to use something like $e^{current_t/max_t}$ but I'm unsure how to effectively convert that in the range $0.00001\cdots0.000001$

Any ideas?

1

There are 1 best solutions below

0
On BEST ANSWER

Your function can depend on two parameters $a,λ$ as follows $$f(x)=ae^{λx}$$ with $f(0)=0.000001$ and $f(k)=0.00001$. This first one gives the value of $a=0.000001$ and the second gives $$0.00001=0.000001e^{λk} \iff \ln 10^{-5}=\ln10^{-6}+λk \iff λ=\frac{-\ln 10}{k}$$ So, given $k$ you can uniquely determine $λ$.