Re: Iterpolation and Dates
- To: mathgroup at smc.vnet.net
- Subject: [mg78526] Re: Iterpolation and Dates
- From: chuck009 <dmilioto at comcast.com>
- Date: Tue, 3 Jul 2007 05:42:08 -0400 (EDT)
I expanded David's work above by generating his list of data points and assigning them to the first 10 days in July and then interpolating the data in order to estimate what the value would be on July 4 at 3:00a. The plot shows this data as well as a red point giving the interpolated value. The results are good: dateData = MapThread[(#1 /. {y_, m_, d_, rest___} :> {y, m, d + #2, rest}) &, {Table[{Pause[0.1]; Date[], i^2.1}, {i, 10}], Range[0, 9]}, 1] absoluteDateData = ({FromDate[#1[[1]]], #1[[2]]} &) /@ dateData interpolatedAbsoluteDateData = Interpolation[absoluteDateData] p1 = Plot[interpolatedAbsoluteDateData[x], {x, First[absoluteDateData][[1]], Last[absoluteDateData][[1]]}] testDate = {2007, 7, 4, 3, 0, 0.0} interpolatedPoint = Graphics[{Red, PointSize[0.01], \ Point[{FromDate[testDate], \ interpolatedAbsoluteDateData[FromDate[testDate]]}]}]; Show[{p1, interpolatedPoint}]