From: Christoph Date: 2002-04-02T04:50:31+09:00 Subject: Re: Why isn't Math object-oriented? "Jack Herrington" wrote in .... > In addition I think you would have to take into account matrix math in > the design of the OO math system. For example, an ideal math system > would allow: > > a = [ 1, 2, 3 ] > b = [ 4, 5, 6 ] > c = a + b > > To give you c = [ 5, 7, 9 ]. In addition, it would be convenient for > the cosine function to take both references to Array objects as well > as Numeric objects. > > Of course, on the other hand, if you have: > > a = [ 'hi', 'there' ] > b = [ 'chucky', 'cheese' ] > c = a + b > > You would want c = [ 'hi', 'there', 'chucky', 'cheese' ]. So finding > a good class design that allows for a robust matrix math enabled > feature set to be combined with a more convenient general purpose > programming model, will be a challenge. Personally I probably would not want that such a ``type-smart'' Array addition. Restricting the vector like addition to specialized classes like NArray actually seems like the right thing to me. > > Have you taken a look at Numerical Ruby? > > http://www.ir.isas.ac.jp/~masa/ruby/index-e.html > > It allows for matrix math, but you do have use NArrays as opposed to > just using the standard array. Though that is not a lot of extra work > for being able to use a great library. /Christoph