How can I scale a value when it is within a threshold?

31 Views Asked by At

I am not a mathematician so I'm not even sure of the correct language to describe this. I also don't know what appropriate tags are for this question so please amend as necessary.

I am looking for a function that would scale it's input when it is within a threshold of a value. The closer the input is to the value, the more dramatic the scaling would be.

For example, given a function x(y, t, s) where y is the input ranging from 0.0 to 1.0 and t is the threshold and s is a scale factor, I require the following output:

x(0, 0.9, 2)   = 0  
x(0.1, 0.9, 2) = 0.1  
x(0.2, 0.9, 2) = 0.2  
...  
x(0.8, 0.9, 2) = 0.8  
x(0.9, 0.9, 2) = 0.9 
x(0.95, 0.9, 2) = 1 
x(1.0, 0.9, 2) = 2 // maximum effect when input is 1.0
x(1.05, 0.9, 2) = 1 // effect slopes off as input > 1.0

The behaviour I'm after is such that when input is less than threshold, the output is equal to the input e.g. x(y, t, s) = y where y <= t, and the output should be s when the input is 1.0 e.g x(1.0, t, s) == 1.0 * s when t < 1.0.

So

x(y, t, s) = y where 0 <= y <= t and
x(1, t, s) = s where t < 1.0

Note, this is just an example of the behaviour I'm looking for, if there are any well known mathematical functions that produce a similar effect I'd be happy to accept those as suggestions.