I am trying to do some matrix multiplication in Mathematica but I just cannot figure out the correct syntax for my problem.
I want to write the following: $$ A\pmatrix{a & b\\c & d}+B\pmatrix{e & f\\g & h}=\pmatrix{Aa+Be & Ab+Bf\\Ac+Bg & Ad+Bh} $$ as $$ \pmatrix{\pmatrix{a & b\\c & d}\\\pmatrix{e & f\\g & h}}\pmatrix{A\\B}=\pmatrix{Aa+Be & Ab+Bf\\Ac+Bg & Ad+Bh} $$
So far I found out that this generates
{{{{a, b}, {c, d}}}, {{{g, h}, {i, j}}}};
MatrixForm[%]
the first tensor. But when I multiply this by {e,f} the result is incorrect. This
{{{{a, b}, {c, d}}}, {{{e, f}, {g, h}}}}.{A, B};
MatrixForm[%]
gives me this as a result: $$ \pmatrix{\pmatrix{Aa & Bb\\Ac & Bd}\\\pmatrix{Ae & Bf\\Ag & Bh}} $$
I think that my problem has an easy fix... probably just some brackets that need to be added, but I just didn't manage to figure it out.
Thanks
Philipp
{}
button above the edit window. The edit window help button?
is also useful for learning how to format your questions and answers. You may also find this this meta Q&A helpful $\endgroup$