Re: New Module Proposal - Math::Interval
Brendan Leber wrote: First, let me apologize for my extremely late reply. Right after I started receiving replies I suffered some pretty serious system failures. I'm now back and replying to old messages. B On Mar 2, 2006, at 9:20 AM, Eric Wilhelm wrote: 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. Yes, the foundation of the class will have functions that support traditional interval functions such as overlap() and intersect(). Out of curiosity, is there a common agreement on these 'traditional interval functions'? The most referenced proposal I'm aware of are the so called Allen relations: Maintaining Knowledge about Temporal Intervals by James F. Allen They are - as the title suggests - somewhat biased towards temporal types (e.g. relation 'during'). A perl implementation is done in Date::Interval: http://search.cpan.org/~ktorp/Interval.0.03/Interval.pm Although the book Temporal Data and the Relational Model by C.J. Date, Hugh Darwen, Nikos Lorentzos http://books.google.com/books?ie=UTF-8vid=ISBN1558608559id=grTubz0fjSECpg=PA91lpg=PA91lsig=PQpCSlzWNl_uS66gfX3Lw2RK-WY is also biased towards temporal types, the authors generalized the interval type: it's a type generator parameterized by a point type. By the way, 'during' was renamed to 'includes'. I have to admit I like their proposal. Are there other essential sources worth to consider? Steffen Goeldner
Re: New Module Proposal - Math::Interval
First, let me apologize for my extremely late reply. Right after I started receiving replies I suffered some pretty serious system failures. I'm now back and replying to old messages. B On Mar 2, 2006, at 9:20 AM, Eric Wilhelm wrote: 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. Yes, the foundation of the class will have functions that support traditional interval functions such as overlap() and intersect(). 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? Not at this time. I had finished the basic support that is required and was about to delve into the implementation of the arithmetic when I was sidetracked. (See above. ;) 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] This is how I envision arithmetic will be implemented. Using Math::BigInt for inspiration I am implementing the operations as class functions and then I'll use override to add support for the various operators. 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); You don't need to set any accuracy bounds when performing Interval Arithmetic. The errors that are introduced are a result of IEEE 784 limitations when representing floating point numbers. The way this example would look is: # a singleton is an Interval with a zero width. # the upper and lower bounds are the same. my $num = Math::Interval-singleton(1); # [1; 1] my $den = Math::Interval-singleton(3); # [3; 3] my $result = $num / $den; # implemented as $num-div($den); # result is approximately [0.; 0.3334] 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. It's all a matter of time. My plan is to keep fleshing out Math::Interval as I have time. The first release is going to support the base functions and the four basic arithmetic operations, +, -, * and /. If anyone else finds the code useful I would welcome contributions. After considering the messages I've received I think the layout should be: Math::Interval - The base support required by the other modules. This module could be used alone to support the traditional concept of intervals on the number line. Math::Interval::Arithmetic - Functions for performing arithmetic with Intervals. Math::Interval::Functions - Support for trig, logarithmic and other functions with Intervals. Math::Interval::Vector - Support for operations on vectors of Intervals. Math::Interval::Matrix - Support for operations on matrices of Intervals. The first two modules would be the initial release and I would release the other modules when they are ready. B -- Brendan Leber [EMAIL PROTECTED] If success or failure of this planet and of human beings depended on how I am and what I do... How would I be? What would I do? -- R. Buckminster Fuller
Re: New Module Proposal - Math::Interval
Orton, Yves writes: Thus, having some math background one would identify Math::Interval::Arithmetic (or maybe more proper, Math::IntervalArithmetic) at a glance in a search for interval. Imo the former form should be heavily preferred over the latter. Math::Interval admits the possibility that there could be a wide range of modules related to intervals. Math::IntervalArithmetic Does not. I completely agree with you if all of these (perhaps theoretical) modules _are_ related to intervals, and intervals in the same sense of the word as each other. But if these modules are actually dealing with different concepts (I've only been skimming this thread -- I'm not really mathsy enough to understand it -- but I think that might be the case) that only co-incidentally share a name then actually there's nothing to be gained in grouping them together. Actually, quite the reverse: there's benefit in splitting them by name into their 2 concepts. So having Math::FooInterval and Math::BarInterval as name-spaces would work for me, for suitable values of Foo and Bar which help to disambiguate the words. But similarly, if one of the meanings of interval is in more common use such that it's the concept mathematicians tend to refer to by that name without any disambiguating adjectives then it also makes sense to have Math::Interval for that concept and Math::FooInterval (or Math::InvervalFoo) for t'other one. So I think Math::Interval::Arithmetic or Math::IntervalArithmetic could be better, depending on whether it's dealing with arithmetic on the same concept as Math::Interval deals with, or whether it's a different concept entirely. Not only that but CamelHump identifiers are considered to bad style in the eyes of much of the community. It is harder for a coder to enter style-heaven than it is to fit a CamelHump through the eye of the community? Smylers
Re: New Module Proposal - Math::Interval
* Smylers [EMAIL PROTECTED] [2006-03-04 12:50]: Orton, Yves writes: Not only that but CamelHump identifiers are considered to bad style in the eyes of much of the community. It is harder for a coder to enter style-heaven than it is to fit a CamelHump through the eye of the community? ++ Laughing, -- #Aristotle *AUTOLOAD=*_;sub _{s/(.*)::(.*)/print$2,(,$\/, )[defined wantarray]/e;$1}; Just-another-Perl-hacker;
Re: New Module Proposal - Math::Interval
* Orton, Yves [EMAIL PROTECTED] [2006-03-03 11:05]: Ah, yeah, EUMM, ok i use that one. The rest, never or rarely. Yeah, but they’re all best-of-breed modules that someone out there who is not you uses all the time. And I still think that form sucks. :-) Fine. :-) What else do you suggest for multi-word names? Always `::`-separating the words? Somehow, while this particular name is absolutely correctly chosen, I find Gtk2::Ex::Simple::List rather hard on my fingers. Gtk2::SimpleList was significantly easier to type, though not a good name in retrospect. Regards, -- Aristotle Pagaltzis // http://plasmasturm.org/
RE: New Module Proposal - Math::Interval
Title: RE: New Module Proposal - Math::Interval Ken Williams wrote on Thursday, March 02, 2006 4:28 AM On Feb 26, 2006, at 6:46 PM, Brendan Leber wrote: First I need to explain a bit about intervals. In this context an interval is a new type of number just like a complex. Intervals are used to represent values in calculations where the answer can not be exactly represented. For example, the quantity 1/3 does not have an exact binary representation so you must round the answer to the nearest representable value. When evaluating calculations with an interval the results are rounded out so that the real answer is somewhere between a lower and upper bound. (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. I agree. Your sense of intervals seems rather to be more akin to error bars on a calculated variable, right? Is this interpretation of intervals necessarily incompatible with the more traditional sense - in other words, could a single interface support both notions? If not, I might suggest something like Math::CalcInterval or something like that, so people know it's this calculational sense that the code deals with. Or maybe Math::Interval::Compute? Allowing Math::Interval to provide intersect(), overlaps(), contains() Yves
Re: New Module Proposal - Math::Interval
On Mar 2, 2006, at 4:28, Ken Williams wrote: Hi Brendan, On Feb 26, 2006, at 6:46 PM, Brendan Leber wrote: First I need to explain a bit about intervals. In this context an interval is a new type of number just like a complex. Intervals are used to represent values in calculations where the answer can not be exactly represented. For example, the quantity 1/3 does not have an exact binary representation so you must round the answer to the nearest representable value. When evaluating calculations with an interval the results are rounded out so that the real answer is somewhere between a lower and upper bound. (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. Agreed. AFAIK the canonical name for this topic is Interval Arithmetic http://en.wikipedia.org/wiki/Interval_arithmetic#Interval_arithmetic which is the basis of Interval Analysis. Thus, having some math background one would identify Math::Interval::Arithmetic (or maybe more proper, Math::IntervalArithmetic) at a glance in a search for interval. Additionally the name suggests arithmetic-like operations on intervals to whom does not know that such a thing exists. That still may suggest set-like operations to some, but the name would be already correct and specific and the docs would clarify that. -- fxn
RE: New Module Proposal - Math::Interval
Title: RE: New Module Proposal - Math::Interval Thus, having some math background one would identify Math::Interval::Arithmetic (or maybe more proper, Math::IntervalArithmetic) at a glance in a search for interval. Imo the former form should be heavily preferred over the latter. Math::Interval admits the possibility that there could be a wide range of modules related to intervals. Math::IntervalArithmetic Does not. Not only that but CamelHump identifiers are considered to bad style in the eyes of much of the community. Yves
Re: New Module Proposal - Math::Interval
On Thu, March 2, 2006 9:19 am, Spencer Ogden said: This type of interval is also know as a Confidence Interval. Math::Statistics::Confidence? Daniel T. Staal --- This email copyright the author. Unless otherwise noted, you are expressly allowed to retransmit, quote, or otherwise use the contents for non-commercial purposes. This copyright will expire 5 years after the author's death, or in 30 years, whichever is longer, unless such a period is in excess of local copyright law. ---
Re: New Module Proposal - Math::Interval
* Orton, Yves [EMAIL PROTECTED] [2006-03-02 12:20]: Not only that but CamelHump identifiers are considered to bad style in the eyes of much of the community. So Math::Intervalarithmetic is better then? Or do you prefer Math::Interval_arithmetic? Is DateTime bad? CamelHump identifiers are actually the community standard for module names. Bad style is not partitioning the name properly into a namespace hierarchy. Caps don’t figure into it. Regards, -- Aristotle Pagaltzis // http://plasmasturm.org/
Re: New Module Proposal - Math::Interval
Hi Brendan, I think Math::Interval is a fine name. If anyone is looking for a module which handles intervals, they'll find it immediately. The main question you seemed to have about this is: Should I create one module Math::Interval or a hierarchy such as: Math::Interval Math::Interval::Arithmetic Math::Interval::Trigonometric Math::Interval::Logarithmic That seems to be in relation to: This module would contain the basic definition and support functions for intervals. I think it should also include the basic arithmetic operations (+, -, *, /) but I have received the suggestion to break those out into a separate module (Math::Interval::Arithmetic). That would allow other people to add their own extensions. Not having seem your code, I'm at a loss to give you a clear answer, but I can give you a good rule of thumb: so long as you create a good, clear API which will not change (unless labeled alpha, experimental, etc.), don't worry about the module organization as much. Write the code you need and use it. As you use it more, you'll have a better understanding of how things should naturally be decomposed. You can do that yourself or, if enough others are interested, post it to the CPAN and ask for feedback. I'd also strongly recommend that you post this to Perlmonks. There are one or two mathematicians running around there. (Oh, and tell Wren I said hi :) Cheers, Ovid -- If this message is a response to a question on a mailing list, please send follow up questions to the list. Web Programming with Perl -- http://users.easystreet.com/ovid/cgi_course/
New Module Proposal - Math::Interval
Greetings! I have a need to create a module to perform calculations with intervals. Since I was unable to find anything on CPAN that fit I thought I would package up my code and submit it so that others can benefit from my work. First I need to explain a bit about intervals. In this context an interval is a new type of number just like a complex. Intervals are used to represent values in calculations where the answer can not be exactly represented. For example, the quantity 1/3 does not have an exact binary representation so you must round the answer to the nearest representable value. When evaluating calculations with an interval the results are rounded out so that the real answer is somewhere between a lower and upper bound. (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/ Being a type of number like complex numbers I used Math::Complex as the inspiration for naming my module Math::Interval. This module would contain the basic definition and support functions for intervals. I think it should also include the basic arithmetic operations (+, -, *, /) but I have received the suggestion to break those out into a separate module (Math::Interval::Arithmetic). That would allow other people to add their own extensions. So, does my naming choice make sense? If not, what would you suggest? Should I create one module Math::Interval or a hierarchy such as: Math::Interval Math::Interval::Arithmetic Math::Interval::Trigonometric Math::Interval::Logarithmic Thanks for your time. Please be gentle, this is my first time. ;) B -- Brendan Leber [EMAIL PROTECTED] Love is omni-inclusive, progressively exquisite, understanding and tender and compassionately attuned to other than self. -- R. Buckminster Fuller