We have 3 matrices: m1
, m2
and b
. We want to apply matrix operations (dot or sum) in a particular way: we want to treat the columns of m2
and b
separately as a vectors and m1
as a matrix.
m1
is a (9*9) matrix:
m1 = {{0, 0.25, 0, 0.25, 0, 0, 0, 0, 0}, {0.25, 0, 0.25, 0, 0.25, 0, 0, 0,0},
{0, 0.25, 0, 0, 0, 0.25, 0, 0, 0}, {0.25, 0, 0, 0, 0.25, 0, 0.25, 0,0},
{0, 0.25, 0, 0.25, 0, 0.25, 0, 0.25, 0}, {0, 0, 0.25, 0, 0.25, 0, 0,0, 0.25},
{0, 0, 0, 0.25, 0, 0, 0, 0.25, 0}, {0, 0, 0, 0, 0.25, 0, 0.25, 0, 0.25},
{0, 0, 0, 0, 0, 0.25, 0, 0.25, 0}}
m2
and b
are (9*15) and (9*9) matrices, respectively, with the elements:
m2 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0,0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0,0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}
b = {{1.5, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 1.5, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0,0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, -1.5, 0, 0}, {0, 0, 0, 0, 0, 0, 0, -1, 0},
{0, 0, 0, 0, 0, 0, 0, 0, -1.5}}
We want to be able to extract any column of m2
and b
as a vector
in a such way, that we will be able to form the product m1
with any extracted vector of m2
and add it to an extracted column of b
in the following way:
column[2][m2] = m1.column[1][m2] + column[1][b]
column[3][m2] = m1.column[2][m2] + column[2][b]
column[4][m2] = m1.column[3][m2 ]+ column[3][b]
column[i][m2] = m1.column[i - 1][m2] + column[i - 1][b]
and so on.
Finally we wanted to populate the matrix m2 with the newly calculated elements instead of zeros.
m1.m2 + b
and extracting the columns of the result. $\endgroup$m2
vanishes. So the result can be taken to be the columns ofb
alone, right? $\endgroup$m2
is the "storage" for the results... $\endgroup$