Get the inverse of ratio, what is the mathematical term?

953 Views Asked by At

I need to create kind of the inversed ratio. What i mean:

Let's say there are the numbers 1,1,2 the ratio is 0.25,0.25,0.5. The sum of the ratio is of course 1. But i want the "inversed" ratio so the small numbers become great and great numbers become small. It still needs the sum of 1. so 1,1,2 becomes 0.375,0.375,0.25

I tried around a bit and came to this algorithm: picture of algorithm (mistake: should be 0.375,0.375,0.25)

Can i simlify the algorithm to a mathmatical expression somehow? And had this "inversed" ratio special name so i do a search for it?

1

There are 1 best solutions below

1
On BEST ANSWER

If you want to have it so that the ratio of any two numbers in the output is the inverse ratio of the same two numbers in the input, then it's pretty simple to do:

  1. Take the multiplicative inverse of your list (so $1, 1, 2$ becomes $1, 1, \frac{1}{2}$).

  2. Do your ratio calculations as before (so we get $1+1+\frac{1}{2} = \frac{5}{2}$, dividing the list elements by this value gives $\frac{2}{5}, \frac{2}{5}, \frac{1}{5} = 0.4, 0.4, 0.2$)