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.
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.
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.
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.
If you want to have the result in the form for input to Mathematica functions that expect points to be lists of coordinates, you’d have to do an additional conversion.
Not sure if I’m doing this correctly, but something like this is needed. Here, I just convert column vectors with 2 components. This would have to be extended to the case of row vectors, and generalized to any number of dimensions.
Would it be possible to Mathematica to automatically interpret row and column vectors as simple lists when they were used to pass points to a function, or would this lead to complications?