## [REBOL] Re: Matrix Arithmetic Rules? Help needed!

### From: joel:neely:fedex at: 10-Jan-2002 13:36

Hi, Mark,
**[Robbo1Mark--aol--com]** wrote:

> Anyway, I would like to redefine the
> prefix REBOL arithmetic & logic functions
> to be able to handle series & matrix arguments...
>

...

> >> multiply [2 3] [2 3]
> == [4 9]
>

Part of the issue is that there are two different multiplications
for vectors, "inner" and "outer" product.
innerproduct [2 3] [5 7]
== 31
outerproduct [2 3] [5 7]
== [[10 14] [15 21]]
OTOH, some would insist that the distinction is based on the
orientation
of the dimensions, so that
multiply [2 3] [5 7]
== 31
multiply [2 3] [[5 7]]
== [[10 15] [14 21]]
and other variations...

> MY PROBLEM / QUERY are these
>
> Firstly What is the correct behavior of performing
> arithmetic and logic functions on arbitarily
> nested blocks, ie matrixes, and secondly what is
> the correct behaviour when series or matrix are of
> differing lengths, ie missing arguments.
>

The first issue is to define what your application(s) is/are,
because that will tell you which notational conventions the
practitioners in that/those area(s) will expect.
Do you want to support:
- simple vectors and matrices from high-school algebra?
- specific geometric/graphical applications (e.g., 3-d graphics
with perspective)?
- quantum mechanics?
I'd suggest taking a specific target domain and writing code to
meet the needs and conventions of that area. Then look at another
area and see how much (if anything) you'd have to change/extend to
meet that new challenge.
-jn-