Multiplying list of matrices with vector of scalars

The name of the pictureThe name of the pictureThe name of the pictureClash 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.









share|improve this question







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.























    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.









    share|improve this question







    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.





















      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.









      share|improve this question







      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






      share|improve this question







      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.











      share|improve this question







      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.









      share|improve this question




      share|improve this question






      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.




















          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]









          share|improve this answer




















          • 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


















          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.






          share|improve this answer






















            Your Answer




            StackExchange.ifUsing("editor", function ()
            return StackExchange.using("mathjaxEditing", function ()
            StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
            StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
            );
            );
            , "mathjax-editing");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "387"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            convertImagesToLinks: false,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );






            gasar8 is a new contributor. Be nice, and check out our Code of Conduct.









             

            draft saved


            draft discarded


















            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






























            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]









            share|improve this answer




















            • 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















            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]









            share|improve this answer




















            • 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













            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]









            share|improve this answer












            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]










            share|improve this answer












            share|improve this answer



            share|improve this answer










            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 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
















            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











            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.






            share|improve this answer


























              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.






              share|improve this answer
























                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.






                share|improve this answer














                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.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited 12 mins ago

























                answered 25 mins ago









                Sjoerd Smit

                2,860715




                2,860715




















                    gasar8 is a new contributor. Be nice, and check out our Code of Conduct.









                     

                    draft saved


                    draft discarded


















                    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.













                     


                    draft saved


                    draft discarded














                    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













































































                    Comments

                    Popular posts from this blog

                    What does second last employer means? [closed]

                    List of Gilmore Girls characters

                    Confectionery