Hello, I have a little math problem. I would like to have a function with these properties:
- for x much bigger than 0: lim f(x) = x
- for x much smaller than 0: lim f(x) = 0
- and f(0) = 1 (sorry, I had here f(1)=1 which was wrong!)
- f(x) should be monotonically increasing
So the function should look somewhat like this:
^
| /
| /
| /
___.-+´
--´-----+------>
|
The best I got so far is x/(1 + e^(-x))
but then I recognized that it drops below 0 and is not monotonically increasing.
A great help for playing around with these function is GraphFunc Online.
Also, it would be helpful if the function is fast to calculate as I need to execute it very often.
EDIT: I am using this in a program to limit values. I have an optimization algorithm, that uses curve fitting with a Levenberg-Marquardt algorithm. But this algorithm does not allow constraints, and optimizes over the full range of real values. So I need a function like this so that I can add an artificial constraint so that the function is bigger than 0. A simple approach would be to use f(x) = x²
but then the function is not monotonically increasing and it has two minimas.
The Levenberg-Marquardt approximates derivatives, so I think it would be best when the function is smooth too. But I am not sure if this is absolutely necessary.