Search code examples
mathformula

Evenly distribute X values within a given range


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.


Solution

  • assuming t = 1..x:

    a[t] = min+t*(max-min) / (x+1)