Yesterday I spent a fair while stuck in what I though was a silly math problem. I wanted to transform a number between two scales. For example, in a scale 12 to 29, and given the number 19, what would be that value in a scale from 1 to 100?
This has to be so easy, a proportion basically... but it got me stuck for a good while (embarrassed tone). That evening my friends Marc and Ester had invited me over for a lovely evening, and I managed to get the Weird Guest Of The Month award by bringing the problem to them (bottle of wine! That would have been better, damn!). Turns out Marc got me on the right track:
End result: S being the source interval, D the destination interval, x the given number, what's y?
y = (x - Smin) * (Dmax - Dmin) / (Smax - Smin) + Dmin
Ahhh, this brings me back to my Uni days... except that I was doing something decently serious back then. :)