Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Evenly distribute X values within a given range

Tags:

math

formula

This is driving me nuts. I am looking for the formula to evenly calculate x values within a range of minimum and maximum values. For instance...

min = 4 max = 20 x = 3

Should equate to...

= 8, 12, 16

I feel like the answer is right in front of my face, I'm sure I covered it at some point during one of my math or statistics courses, but I just can't puzzle it out. I have looked at similar questions here, but they are all programming specific and aren't really shedding any light for me. I would think there has to be a basic formula for this. Any help would be greatly appreciated.

like image 541
arkon Avatar asked Oct 02 '22 23:10

arkon


1 Answers

assuming t = 1..x:

a[t] = min+t*(max-min) / (x+1)
like image 191
pentadecagon Avatar answered Oct 13 '22 10:10

pentadecagon