Group Abstract Group Abstract

Message Boards Message Boards

0
|
85.2K Views
|
8 Replies
|
9 Total Likes
View groups...
Share
Share this post:

How to get the result of a multiplication between a matrix and a vector?

Posted 11 years ago

I want to get the result of a multiplication between a matrix and a vector, basically I want to do a change of reference frame of a vector, so I cannot perform this operation in mathematica.

A = {{2, 4}, {2, 1}} // MatrixForm
C2 = {{6}, {5}} // MatrixForm
A.C2 (*This does not work*)

I want to get something like this:

{{2, 4}, {2, 1}}.{{6}, {5}} // MatrixForm

Actually I have something more complex, but this is enough to show my problem.

Do you have any suggestion?

8 Replies

I find it helpful to use MatrixForm as follows:

(A={{2,4},{2,1}})//MatrixForm
(C2={{6},{5}})//MatrixForm
(A.C2 )//MatrixForm

In this way, the MatrixForm is applied to the output of the Set (=) function rather than the second argument of Set.

POSTED BY: Jason Grigsby

Thanks for your explanation. Frank Kampas

Thanks for your response David Keith, it is very helpful.

More simply

In[20]:= {{2, 4}, {2, 1}}.{6, 5}


Out[20]= {32, 17}
POSTED BY: S M Blinder
Posted 11 years ago

Frank makes an important point. In Mathematica the dot operator is overloaded, and can be matrix multiplication, matrix-vector multiplication,vector-matrix multiplication, or the scalar dot product of vectors, depending on context. If possible, Mathematica also conforms the vectors as needed. For example, a nxm matrix can multiply a m-wide row vector without objection.

POSTED BY: David Keith

It's also important to recognize that the dot product operator is also the operator for multiplying matrices, which allows some things which are not standard linear algebra.

POSTED BY: Frank Kampas
Posted 11 years ago

MatrixForm is a print wrapper for display purposes. Don't use it in the definitions, only to display results. Also, it is best to not begin user-defined symbols with upper case, since that can conflict with built-in names.

In[1]:= a = {{2, 4}, {2, 1}};
c2 = {{6}, {5}};
a.c2

Out[3]= {{32}, {17}}
POSTED BY: David Keith
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard