Search code examples
pythonmathdiscrete-mathematics

Is possible to modify exponential function to get values [1, A] from domain [0, B]


I have a math problem... I want to get saturation function which works like that:

Illustrative figure

I tried with the following code:

def sat_f(x, A, B, base=1.5):
   y = np.power(base, x)
   y_max = np.power(base, B)
   norm_coeff = A / y_max
   y = norm_coeff * y
   return y

But I have problem to get f(0) = 1 when it's scaled


Solution

  • Not a python guy, but mathematically what you need is:

    f(x) = A^(x/B)

    This will give you:

    f(0) = 1

    f(B) = A

    and in-between range the function will grow exponentially w.r.t A

    hope this helps 👍