Return value for which a function reaches its smallest negative value in
python
It's pretty late, so I don't know how clear this will be.
I have a function f(x), I want to get the value of x from a list for which
f(x) reachest the smallest negative value, namely:
x = [0, 2, 4, 6]
f(x) = [200, 0, -3, -1000]
In this case, I would like something to return the value 4 in x, which
gave me -3. I don't want the absolute minimum (-1000), but the negative
value with the lowest absolute value.
I hope that makes sense, thanks a lot for your help.
No comments:
Post a Comment