Inverse relationship of two variables
- by Jam
this one is maybe pretty stupid.. Or I am just exhausted or something, but I just cant seem to solve it..
Problem : two variables X and Y, value of Y is dependent on value of X. X can have values ranging from some value to some value (lets say from 0 to 250) and y can have different values (lets say from 0.1 to 1.0 or something..) - but it is inverse relatonship (what I mean is: if value of X is e.g. 250, then value of Y would be 0.1 and when X decreases up to 0, value of Y raises up to 1.0..
So how should I do it? lets say I have function:
-- double computeValue (double X) { /computation/ return Y; }
Also, is there some easy way to somehow make the scaling of the function not so linear? - For example when X raises, Y decreases slower at first but then more rapidly in the end.. (rly dont know how to say it but I hope you guys got it)
Thanks in advance for this stupid question :/