On Thu, 10 Jun 2004 [EMAIL PROTECTED] wrote:
How about a DateTime::Span->midpoint method?

On 11 Jun 2004, at 6:55 AM, Dave Rolsky replied:
Let's wait and see if others ask for it.  For now, let's just add those
recipes to the faq.

I'm not sure of the best namespace, but I can see a Util namespace would be a good place for FRSs (Frequently Required Solutions)


        use DateTime::Util::Stats qw/:all/;
        # Solar Noon is the mean of sunrise and sunset:
        my $mean   = mean_datetime( @dt_list )
        # The mean is: round(scalar(@_) + 1 / 2) # IIRC
        #   therefore $median == $sunset
        my $median = median_datetime( @dt_list )

On the other hand, maybe these should be DateTime::Set methods:
        my $mean   = $set->mean( $sunrise, $sunset );
        my $median = $set->median( $sunrise, $sunset );

I'm not sure that DateTime::Span is a good place for these as it would only apply to getting the mean of two DateTime objects whereas in DateTime::Set it's scope increases to allow any number of DateTimes.

Would/Could there be any use for other statistical functions such as Standard Deviations? I can't think of any possible need for StdDev at the moment, but maybe there getting rid of outliers will be of benefit to someone?

Cheers!
Rick

Senior Developer
PrintSupply - Print Procurement & Supply Management
18 Greenaway Street VIC 3105
Tel: (03) 9850 3255
Fx: (03) 9850 3277
http://www.printsupply.com.au/



Reply via email to