# from Ken Williams
# on Wednesday 01 March 2006 07:28 pm:

>>(The lower bound is  
>> rounded down toward negative infinity and the upper bound is  
>> rounded up to positive infinity.)  So dividing 1 by 3 could result  
>> in the interval [0.333; 0.334].  If you want to learn more the best
>>   place to start is at: http://www.cs.utep.edu/interval-comp/
>
>I fear that the name "interval" might be somewhat misleading here.  
>If I saw Math::Interval on CPAN, I'd expect it to deal with connected
>   subsets of the real number line, and to support methods like
> intersect (), overlaps(), contains(), and so on.  This is the sense
> that we'd find in, say, the Rivest/Cormen/et-al algorithms book.

It sounds like this usage is part of the foundation (if not "base") 
class Math::Interval which Brendan will need even though he might not 
be working directly on those bits.

Brendan, do you have some example code?  Maybe some code of what you're 
trying to do without the module and corresponding snippets for how you 
would like the code to look with the module?

Error bars are a special case of subsets on the real number line in that 
they are rounded to a given precision.  So, I would expect 
Math::Interval to provide basic arithmetic between intervals as well as 
between numbers and intervals:

  my $d = Math::Interval->new(3.2, 4.2);
  my $r = $d + 7; # returns an interval [10.2,11.2]

  # adding intervals adds the endpoints (ala Math::Vec), right?
  my $d = Math::Interval->new(2,4) + Math::Interval->new(3,8);
  # returns an interval [5,12]

And then you have intersect(), overlap(), etc for those dealing purely 
in interval manipulations, but Brendan wants to generate some error 
bars, so he needs Math::ConfidenceInterval, where most of the 
calculations return a new Math::Interval object:

  my $conf = Math::ConfidenceInterval->new(0.001); # 0.001 accuracy
  my $d = $conf->divide(1,3);
  # returns a Math::Interval->new(0.333, 0.334);

Maybe Brendan isn't planning to flesh-out Math::Interval right now, but 
someone that wants to do that can either send him patches or take over 
maintenance of it.  I certainly don't think he should be using 
something like Math::ConfidenceInterval::Interval when a generic 
Interval can be used to represent his results and with a few more 
methods could also be applied to the "subsets manipulation" interval 
problem.

--Eric
-- 
"Everything goes wrong all at once."
--Quantized Revision of Murphy's Law
---------------------------------------------------
    http://scratchcomputing.com
---------------------------------------------------

Reply via email to