It occurred to me today that I have forgotten almost all of my high school math, so I need some assistance working out some basic math in Ruby.
Essentially, I have a set of values from 1 to 10. Right now, I simply multiply them by 10 to get a figure I use as a percentage. eg 2 = 20%, 4 = 40% etc.
This is a little too linear and so what I really need to do is calculate a exponential decay style value, where by values closer down to 1 are given a more generous percentage and numbers closer up to 9 and 10 the percentage flattens out.
There is a possibility that there may be more than 10 numbers in the future too, so for example, 1 to 20. Im assuming this is simply enough to change?
Here is a quick chart that describes what im trying to do.
Can anyone help me figure this one out? Preferably in Ruby but otherwise any pseudo code would help.