[Haskell-cafe] practice problems?

Brian Hulley brianh at metamilk.com
Sun Sep 3 16:20:00 EDT 2006


Paul Johnson wrote:
> "Brian Hulley" <brianh at metamilk.com> wrote:
>
>>    What about a library for interval arithmetic [1]?
>>
>>    [Interval 5 5] / [Interval -1 1] = [FromNegInfinityTo -5,
>>    ToPosInfinityFrom 5]
>
> Take a look at my Ranged Sets library at
>
> http://sourceforge.net/projects/ranged-sets

Hi Paul -
Thanks for the link to your lib (do you want to add a link from 
http://www.haskell.org/haskellwiki/Libraries_and_tools/Mathematics ?)

I've only had time to have a brief look but it seems that RSet's could be 
used as interval arithmetic numbers with suitable instance decls for Num 
etc. My knowledge of interval arithmetic itself however is not sufficient to 
tell at this moment if the full generality of RSet's is actually needed ie 
perhaps it is enough to just say that division by a range containing zero 
should be undefined and perhaps there are no other ops which would cause 
more than one result range in which case it would be inefficient to use a 
more general representation than needed.

Possibly there could be two different implementations of interval 
arithmetic - one allowing for multiple ranges and one that just treated 
division by an interval containing zero (and other problematic situations) 
to be undefined, so that the results of each op would be a single range when 
machine-level speed is needed and it is known in advance that division by 
zero etc will not happen in the specific problem domain.

Anyway thanks for sharing your library with a nice BSD3 license! :-)

Regards, Brian.
-- 
Logic empowers us and Love gives us purpose.
Yet still phantoms restless for eras long past,
congealed in the present in unthought forms,
strive mightily unseen to destroy us.

http://www.metamilk.com 



More information about the Haskell-Cafe mailing list