"Christoph" <chr_news / gmx.net> wrote in message news:<a881d2$qgr$06$1 / news.t-online.com>...
> RE: Why isn't Math object-oriented?
> Personally I don't believe that the latter is possible within Ruby's current Object model.
> Maybe the best testimony for this unfortunate fact is the extensive use of the ingenious
> coerce framework in the Numeric class hierarchy which stikes me as being antithetical
> to my own understanding of object oriented techniques ( -i.e. the main question probably
> is ``what the meaning of object oriented is'')
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.
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.