Multiplying list of matrices with vector of scalars
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
there are many similar threads on this forum, but none of them fixes my problem. I am trying to multiply List of Pauli Matrices with a vector of symbols (which are scalars).
PauliMatrices[Range[3]].W1, W2, W3
and I would like to get something like
W3, W1 - I W2,W1 + I W2, -W3.
matrix vector
New contributor
gasar8 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |Â
up vote
1
down vote
favorite
there are many similar threads on this forum, but none of them fixes my problem. I am trying to multiply List of Pauli Matrices with a vector of symbols (which are scalars).
PauliMatrices[Range[3]].W1, W2, W3
and I would like to get something like
W3, W1 - I W2,W1 + I W2, -W3.
matrix vector
New contributor
gasar8 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
there are many similar threads on this forum, but none of them fixes my problem. I am trying to multiply List of Pauli Matrices with a vector of symbols (which are scalars).
PauliMatrices[Range[3]].W1, W2, W3
and I would like to get something like
W3, W1 - I W2,W1 + I W2, -W3.
matrix vector
New contributor
gasar8 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
there are many similar threads on this forum, but none of them fixes my problem. I am trying to multiply List of Pauli Matrices with a vector of symbols (which are scalars).
PauliMatrices[Range[3]].W1, W2, W3
and I would like to get something like
W3, W1 - I W2,W1 + I W2, -W3.
matrix vector
matrix vector
New contributor
gasar8 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
gasar8 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
gasar8 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 2 hours ago
gasar8
83
83
New contributor
gasar8 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
gasar8 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
gasar8 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |Â
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
1
down vote
accepted
Just leave away the Dot
(.
):
A = Map[Array[#, 2, 2] &, a, b, c];
W = Array[w, 3];
A W
a[1, 1] w[1], a[1, 2] w[1], a[2, 1] w[1], a[2, 2] w[1],
b[1, 1] w[2], b[1, 2] w[2], b[2, 1] w[2], b[2, 2] w[2],
c[1, 1] w[3], c[1, 2] w[3], c[2, 1] w[3], c[2, 2] w[3]
Ok, this is strange. I tried this and didn't work when I used a vector from Basic Math Assistant palettes? If I write the vector as in question and withoutDot
, it is OK.
– gasar8
2 hours ago
add a comment |Â
up vote
3
down vote
An easy way to achieve this, is to use Inner
with a level specification. In this case, you want the inner product to work only on the first level:
Inner[Times, PauliMatrix[Range[3]], W1, W2, W3, Plus, 1]
W3, W1 - I W2, W1 + I W2, -W3
Edit
Alternatively, you can exchange the order of the Dot
product:
W1, W2, W3.PauliMatrix[Range[3]]
W3, W1 - I W2, W1 + I W2, -W3
The reason this works, is because Dot
contracts the last index of the first argument with the first index of the last argument. Since Dimensions[PauliMatrix[Range[3]]]
equals 3, 2, 2
, it should be the second argument of Dot
if you want to contract it with a length-3 vector.
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
Just leave away the Dot
(.
):
A = Map[Array[#, 2, 2] &, a, b, c];
W = Array[w, 3];
A W
a[1, 1] w[1], a[1, 2] w[1], a[2, 1] w[1], a[2, 2] w[1],
b[1, 1] w[2], b[1, 2] w[2], b[2, 1] w[2], b[2, 2] w[2],
c[1, 1] w[3], c[1, 2] w[3], c[2, 1] w[3], c[2, 2] w[3]
Ok, this is strange. I tried this and didn't work when I used a vector from Basic Math Assistant palettes? If I write the vector as in question and withoutDot
, it is OK.
– gasar8
2 hours ago
add a comment |Â
up vote
1
down vote
accepted
Just leave away the Dot
(.
):
A = Map[Array[#, 2, 2] &, a, b, c];
W = Array[w, 3];
A W
a[1, 1] w[1], a[1, 2] w[1], a[2, 1] w[1], a[2, 2] w[1],
b[1, 1] w[2], b[1, 2] w[2], b[2, 1] w[2], b[2, 2] w[2],
c[1, 1] w[3], c[1, 2] w[3], c[2, 1] w[3], c[2, 2] w[3]
Ok, this is strange. I tried this and didn't work when I used a vector from Basic Math Assistant palettes? If I write the vector as in question and withoutDot
, it is OK.
– gasar8
2 hours ago
add a comment |Â
up vote
1
down vote
accepted
up vote
1
down vote
accepted
Just leave away the Dot
(.
):
A = Map[Array[#, 2, 2] &, a, b, c];
W = Array[w, 3];
A W
a[1, 1] w[1], a[1, 2] w[1], a[2, 1] w[1], a[2, 2] w[1],
b[1, 1] w[2], b[1, 2] w[2], b[2, 1] w[2], b[2, 2] w[2],
c[1, 1] w[3], c[1, 2] w[3], c[2, 1] w[3], c[2, 2] w[3]
Just leave away the Dot
(.
):
A = Map[Array[#, 2, 2] &, a, b, c];
W = Array[w, 3];
A W
a[1, 1] w[1], a[1, 2] w[1], a[2, 1] w[1], a[2, 2] w[1],
b[1, 1] w[2], b[1, 2] w[2], b[2, 1] w[2], b[2, 2] w[2],
c[1, 1] w[3], c[1, 2] w[3], c[2, 1] w[3], c[2, 2] w[3]
answered 2 hours ago


Henrik Schumacher
41.3k259124
41.3k259124
Ok, this is strange. I tried this and didn't work when I used a vector from Basic Math Assistant palettes? If I write the vector as in question and withoutDot
, it is OK.
– gasar8
2 hours ago
add a comment |Â
Ok, this is strange. I tried this and didn't work when I used a vector from Basic Math Assistant palettes? If I write the vector as in question and withoutDot
, it is OK.
– gasar8
2 hours ago
Ok, this is strange. I tried this and didn't work when I used a vector from Basic Math Assistant palettes? If I write the vector as in question and without
Dot
, it is OK.– gasar8
2 hours ago
Ok, this is strange. I tried this and didn't work when I used a vector from Basic Math Assistant palettes? If I write the vector as in question and without
Dot
, it is OK.– gasar8
2 hours ago
add a comment |Â
up vote
3
down vote
An easy way to achieve this, is to use Inner
with a level specification. In this case, you want the inner product to work only on the first level:
Inner[Times, PauliMatrix[Range[3]], W1, W2, W3, Plus, 1]
W3, W1 - I W2, W1 + I W2, -W3
Edit
Alternatively, you can exchange the order of the Dot
product:
W1, W2, W3.PauliMatrix[Range[3]]
W3, W1 - I W2, W1 + I W2, -W3
The reason this works, is because Dot
contracts the last index of the first argument with the first index of the last argument. Since Dimensions[PauliMatrix[Range[3]]]
equals 3, 2, 2
, it should be the second argument of Dot
if you want to contract it with a length-3 vector.
add a comment |Â
up vote
3
down vote
An easy way to achieve this, is to use Inner
with a level specification. In this case, you want the inner product to work only on the first level:
Inner[Times, PauliMatrix[Range[3]], W1, W2, W3, Plus, 1]
W3, W1 - I W2, W1 + I W2, -W3
Edit
Alternatively, you can exchange the order of the Dot
product:
W1, W2, W3.PauliMatrix[Range[3]]
W3, W1 - I W2, W1 + I W2, -W3
The reason this works, is because Dot
contracts the last index of the first argument with the first index of the last argument. Since Dimensions[PauliMatrix[Range[3]]]
equals 3, 2, 2
, it should be the second argument of Dot
if you want to contract it with a length-3 vector.
add a comment |Â
up vote
3
down vote
up vote
3
down vote
An easy way to achieve this, is to use Inner
with a level specification. In this case, you want the inner product to work only on the first level:
Inner[Times, PauliMatrix[Range[3]], W1, W2, W3, Plus, 1]
W3, W1 - I W2, W1 + I W2, -W3
Edit
Alternatively, you can exchange the order of the Dot
product:
W1, W2, W3.PauliMatrix[Range[3]]
W3, W1 - I W2, W1 + I W2, -W3
The reason this works, is because Dot
contracts the last index of the first argument with the first index of the last argument. Since Dimensions[PauliMatrix[Range[3]]]
equals 3, 2, 2
, it should be the second argument of Dot
if you want to contract it with a length-3 vector.
An easy way to achieve this, is to use Inner
with a level specification. In this case, you want the inner product to work only on the first level:
Inner[Times, PauliMatrix[Range[3]], W1, W2, W3, Plus, 1]
W3, W1 - I W2, W1 + I W2, -W3
Edit
Alternatively, you can exchange the order of the Dot
product:
W1, W2, W3.PauliMatrix[Range[3]]
W3, W1 - I W2, W1 + I W2, -W3
The reason this works, is because Dot
contracts the last index of the first argument with the first index of the last argument. Since Dimensions[PauliMatrix[Range[3]]]
equals 3, 2, 2
, it should be the second argument of Dot
if you want to contract it with a length-3 vector.
edited 12 mins ago
answered 25 mins ago


Sjoerd Smit
2,860715
2,860715
add a comment |Â
add a comment |Â
gasar8 is a new contributor. Be nice, and check out our Code of Conduct.
gasar8 is a new contributor. Be nice, and check out our Code of Conduct.
gasar8 is a new contributor. Be nice, and check out our Code of Conduct.
gasar8 is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f183360%2fmultiplying-list-of-matrices-with-vector-of-scalars%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password