Small Data transformation: need answer quickish

Jesus, last week’s adventure with general anesthesia must have rotted holes in my brain. I’ve been poking at this simple data transformation for an hour and can’t make it work out. A little help, please and thank you.

Convert range on left to range on right, proportionally.

    20.425   80.000

20.983
22.674
22.697
23.667
24.440
24.555
24.631 40.000

This is very mildly for commercial purposes, but not “homework.” Thanks. Payment in wooden nickels available.

I think you’re after this?



20.425	80	80
20.983		74.69329529
22.674		58.61150737
22.697		58.39277223
23.667		49.16785544
24.44		41.81645269
24.555		40.72277699
24.631	40	40


Someday you’ll have to show me how you did that. I useta know, back when I had brain cells.

Thanks. PM me if you need anything in a graphics/publications/online etc. vein.

If I label the entries like a spreadsheet, then A1, A8, B1, and B8 are the relevant input values.

Taking the first row as our “origin”, the scaling factor from one column to the next is (B8-B1)/(A8-A1). To actually scale a given entry, though, I need to subtract out the old offset A1, then scale the number, then add in the new offset. The reason is that the overall offset of the two scales is irrelevant if we just want a linear interpolation between the given entries at rows 1 and 8.

In the end, then, Bn = (An - A1) * (B8 - B1) / (A8 - A1) + B1 .

(I wonder if part of the trouble is that your starting and ending ranges run in opposite directions: low to high becomes high to low. This isn’t a problem for the math, but it could mess with one’s intuition.)

This is a transformation to control cell shading on a graphic; I do this stuff day in and day out and things like an inverted output scale are no hurdle. I just could not seem to find the right model for rescaling the data, even after going at it very slowly a couple of times.

Many thanks. Now I can go back to the couch, where both the puppy and can sleep off the remnants of the fentanyl or whatever the hell it was.