Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

MMULT() for 3 matrices

2,110 views
Skip to first unread message

R Firmin

unread,
Feb 13, 2003, 5:41:30 AM2/13/03
to
MMULT() works for two matrices, but not for three.
Does anyone know how to get the correct result for three,
as in:
d e f m
[a b c] g h i n
j k l o
If the first MMULT() operation results in a scalar, you
can't just do a scalar multiplication. The three matices
have to be multiplied together.

mows

unread,
Feb 13, 2003, 7:27:53 AM2/13/03
to
"R Firmin" <robf...@sbcglobal.net> wrote in message
news:055301c2d34c$781e1d90$a201...@phx.gbl...

Do you mean something like

MMULT(MMULT(aaray1, array2), array3)
or
MMULT(array1, MMULT(aaray2, array3))

mows
ExcelXP /WinXP


Harlan Grove

unread,
Feb 13, 2003, 12:30:02 PM2/13/03
to
"mows" wrote...

>"R Firmin" <robf...@sbcglobal.net> wrote in message
>>MMULT() works for two matrices, but not for three.
>>Does anyone know how to get the correct result for three,
>>as in:
>> d e f m
>>[a b c] g h i n
>> j k l o
>>If the first MMULT() operation results in a scalar, you
>>can't just do a scalar multiplication. The three matices
>>have to be multiplied together.
>
>Do you mean something like
>
>MMULT(MMULT(aaray1, array2), array3)
>or
>MMULT(array1, MMULT(aaray2, array3))

Doesn't look like the OP means either of these. The OP did state the problem
clearly, but the example was skimpy. The problem would be that when the
2nd/middle matrix conforms to both the 1st and 3rd matrices, your formulas work.
However, when all 3 matrices are 1xN, Nx1 and Nx1, respectively, MMULT wont
work. That is,

=MMULT(MMULT({1,2,3},{4;5;6}),{7;8;9})

returns an error. The only fully general solution would be something like

=IF(COUNT(MMULT(X,Y))=1,MMULT(X,Y)*Z,
IF(COUNT(MMULT(Y,Z))=1,X*MMULT(Y,Z),
MMULT(MMULT(X,Y),Z)))

Note, however, that situations in which the 2nd matrix doesn't conform to both
1st and 3rd matrices are actually results of dot products times other vectors,
and the order of evaluation is essential. Thus the two operations aren't
associative, thus this is *not* two matrix multiplications.

--
Public Service Announcement
Don't attach files to postings in nonbinary newsgroups like this one.

mows

unread,
Feb 13, 2003, 1:12:16 PM2/13/03
to

"Harlan Grove" <hrl...@aol.com> wrote in message
news:uCQ2a.12589$15....@www.newsranger.com...

Harlan,

The formula I did was intended to be effectively the dot product.of 3 square
matrices or at least ones whose dimensions are correct. Clearly I have
misunderstood what OP was wanting.

mows


0 new messages