|Time Considered As A Helix of Probability Slopes
||[Aug. 8th, 2007|12:51 am]
wrong, per se, but distinctly suboptimal.I was standing in the shower this morning thinking about the questions I was going to ask a colleague about how he wanted some data interpolated, and I suddenly had the realization that the way we had been going about it before was all wrong. Well, maybe not |
Time, you see, is a helix. At least if you care about things relating to the seasonal cycle. So the right way to do these things is to interpolate from decades down to years along the surface of the cylinder, and then to unwind time back into a straight line and interpolate from seasons or months down to weeks or days once you have something for each year. Or, to put it another way, if you have a matrix with years along one dimension and months along the other, I was interpolating them in the wrong order (it needs to be years and *then* months) and pasting the results together, which makes for nasty jumps, rather than getting a smooth curve by doing it the other way around.
There are two nifty things about this.
The first is the way that thinking about it spatially makes it much easier to get it right. Yeah, what the code I ended up writing does is to run approx() on rows from an array, but flipping an imaginary spool of thread around in my head makes it all very clear what was wrong with the previous approach and right with the new one.
The second is that I came up with this in the shower and thought about it all the way in to work, so I got to add an hour of work to my day's total before I even got there.
(And I just got finished with about 3 hours worth of work at home this evening, because the final pieces of the solution were just sitting there in my brain, so I figured I might as well get them written down now before going to bed.)