1
$\begingroup$

I am literally just defining a list of matrices, but seem to run into the following error when adding the last matrix. (so to be clear, I get no error when I take out the last matrix entry). What's going on?

enter image description here

Upon suggestion, I have copied as a cell expression and pasted here


Cell[BoxData[
 RowBox[{
  TagBox[
   RowBox[{"SU4basis", "=", 
    RowBox[{"{", 
     RowBox[{
      RowBox[{"(", "\[NoBreak]", GridBox[{
         {
          RowBox[{"0", " "}], "1", "0", "0"},
         {"1", 
          RowBox[{"0", " "}], "0", "0"},
         {"0", "0", "0", "1"},
         {"0", "0", "1", "0"}
        },
        GridBoxAlignment->{
         "Columns" -> {{Center}}, "ColumnsIndexed" -> {}, 
          "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
        GridBoxSpacings->{"Columns" -> {
            Offset[0.27999999999999997`], {
             Offset[0.7]}, 
            Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, 
          "Rows" -> {
            Offset[0.2], {
             Offset[0.4]}, 
            Offset[0.2]}, "RowsIndexed" -> {}}], "\[NoBreak]", ")"}], 
      ",", 
      TagBox[
       RowBox[{"(", "\[NoBreak]", GridBox[{
          {
           RowBox[{"0", " "}], 
           RowBox[{"-", "I"}], "0", "0"},
          {"I", 
           RowBox[{"0", " "}], "0", "0"},
          {"0", "0", "0", 
           RowBox[{"-", "I"}]},
          {"0", "0", "I", "0"}
         },

         GridBoxAlignment->{
          "Columns" -> {{Center}}, "ColumnsIndexed" -> {}, 
           "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
         GridBoxSpacings->{"Columns" -> {
             Offset[0.27999999999999997`], {
              Offset[0.7]}, 
             Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, 
           "Rows" -> {
             Offset[0.2], {
              Offset[0.4]}, 
             Offset[0.2]}, "RowsIndexed" -> {}}], "\[NoBreak]", ")"}],

       Function[BoxForm`e$, 
        MatrixForm[BoxForm`e$]]], ",", 
      TagBox[
       RowBox[{"(", "\[NoBreak]", GridBox[{
          {"1", "0", "0", "0"},
          {"0", 
           RowBox[{"-", "1"}], "0", "0"},
          {"0", "0", "1", "0"},
          {"0", "0", "0", 
           RowBox[{"-", "1"}]}
         },

         GridBoxAlignment->{
          "Columns" -> {{Center}}, "ColumnsIndexed" -> {}, 
           "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
         GridBoxSpacings->{"Columns" -> {
             Offset[0.27999999999999997`], {
              Offset[0.7]}, 
             Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, 
           "Rows" -> {
             Offset[0.2], {
              Offset[0.4]}, 
             Offset[0.2]}, "RowsIndexed" -> {}}], "\[NoBreak]", ")"}],

       Function[BoxForm`e$, 
        MatrixForm[BoxForm`e$]]], ",", 
      RowBox[{"(", "\[NoBreak]", GridBox[{
         {
          RowBox[{"0", " "}], "1", "0", "0"},
         {"1", 
          RowBox[{"0", " "}], "0", "0"},
         {"0", "0", "0", 
          RowBox[{"-", "1"}]},
         {"0", "0", 
          RowBox[{"-", "1"}], "0"}
        },
        GridBoxAlignment->{
         "Columns" -> {{Center}}, "ColumnsIndexed" -> {}, 
          "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
        GridBoxSpacings->{"Columns" -> {
            Offset[0.27999999999999997`], {
             Offset[0.7]}, 
            Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, 
          "Rows" -> {
            Offset[0.2], {
             Offset[0.4]}, 
            Offset[0.2]}, "RowsIndexed" -> {}}], "\[NoBreak]", ")"}], 
      ",", 
      TagBox[
       RowBox[{"(", "\[NoBreak]", GridBox[{
          {
           RowBox[{"0", " "}], 
           RowBox[{"-", "I"}], "0", "0"},
          {"I", 
           RowBox[{"0", " "}], "0", "0"},
          {"0", "0", "0", "I"},
          {"0", "0", 
           RowBox[{"-", "I"}], "0"}
         },

         GridBoxAlignment->{
          "Columns" -> {{Center}}, "ColumnsIndexed" -> {}, 
           "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
         GridBoxSpacings->{"Columns" -> {
             Offset[0.27999999999999997`], {
              Offset[0.7]}, 
             Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, 
           "Rows" -> {
             Offset[0.2], {
              Offset[0.4]}, 
             Offset[0.2]}, "RowsIndexed" -> {}}], ")"}],
       Function[BoxForm`e$, 
        MatrixForm[BoxForm`e$]]], ",", 
      TagBox[
       RowBox[{"(", "\[NoBreak]", GridBox[{
          {"1", "0", "0", "0"},
          {"0", 
           RowBox[{"-", "1"}], "0", "0"},
          {"0", "0", 
           RowBox[{"-", "1"}], "0"},
          {"0", "0", "0", 
           RowBox[{"1", " "}]}
         },

         GridBoxAlignment->{
          "Columns" -> {{Center}}, "ColumnsIndexed" -> {}, 
           "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
         GridBoxSpacings->{"Columns" -> {
             Offset[0.27999999999999997`], {
              Offset[0.7]}, 
             Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, 
           "Rows" -> {
             Offset[0.2], {
              Offset[0.4]}, 
             Offset[0.2]}, "RowsIndexed" -> {}}], "\[NoBreak]", ")"}],

       Function[BoxForm`e$, 
        MatrixForm[BoxForm`e$]]], ",", 
      TagBox[
       RowBox[{"(", "\[NoBreak]", GridBox[{
          {"1", "0", "0", "0"},
          {"0", "1", "0", "0"},
          {"0", "0", 
           RowBox[{"-", "1"}], "0"},
          {"0", "0", "0", 
           RowBox[{"-", "1"}]}
         },

         GridBoxAlignment->{
          "Columns" -> {{Center}}, "ColumnsIndexed" -> {}, 
           "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
         GridBoxSpacings->{"Columns" -> {
             Offset[0.27999999999999997`], {
              Offset[0.7]}, 
             Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, 
           "Rows" -> {
             Offset[0.2], {
              Offset[0.4]}, 
             Offset[0.2]}, "RowsIndexed" -> {}}], "\[NoBreak]", ")"}],

       Function[BoxForm`e$, 
        MatrixForm[BoxForm`e$]]], ",", 
      TagBox[
       RowBox[{
        RowBox[{"(", "\[NoBreak]", GridBox[{
           {"0", "0", "1", "0"},
           {"0", "0", "0", "0"},
           {"1", "0", "0", "0"},
           {"0", "0", "0", "0"}
          },

          GridBoxAlignment->{
           "Columns" -> {{Center}}, "ColumnsIndexed" -> {}, 
            "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
          GridBoxSpacings->{"Columns" -> {
              Offset[0.27999999999999997`], {
               Offset[0.7]}, 
              Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, 
            "Rows" -> {
              Offset[0.2], {
               Offset[0.4]}, 
              Offset[0.2]}, "RowsIndexed" -> {}}], "\[NoBreak]", 
         ")"}], ",", 
        RowBox[{"(", "\[NoBreak]", GridBox[{
           {"0", "0", "0", "1"},
           {"0", "0", "0", "0"},
           {"0", "0", "0", "0"},
           {"1", "0", "0", "0"}
          },

          GridBoxAlignment->{
           "Columns" -> {{Center}}, "ColumnsIndexed" -> {}, 
            "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
          GridBoxSpacings->{"Columns" -> {
              Offset[0.27999999999999997`], {
               Offset[0.7]}, 
              Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, 
            "Rows" -> {
              Offset[0.2], {
               Offset[0.4]}, 
              Offset[0.2]}, "RowsIndexed" -> {}}], "\[NoBreak]", 
         ")"}]}],
       Function[BoxForm`e$, 
        MatrixForm[BoxForm`e$]]]}], "}"}]}],
   Function[BoxForm`e$, 
    MatrixForm[BoxForm`e$]]], ";"}]], "Input",
 CellChangeTimes->{{3.794851602429001*^9, 3.794851618955934*^9}, {
  3.794851651456861*^9, 3.7948517216909847`*^9}, {
  3.7948517544704437`*^9, 3.794851803181211*^9}, {
  3.794851941629418*^9, 3.794851965204459*^9}, {3.79485201764324*^9, 
  3.794852050947977*^9}, {3.794852081870775*^9, 
  3.7948522392520933`*^9}, {3.794903939788101*^9, 
  3.7949039602339907`*^9}, {3.794904006978363*^9, 
  3.794904036028595*^9}, {3.7949041141555843`*^9, 
  3.7949041391160603`*^9}, {3.794904213106491*^9, 
  3.794904291358384*^9}, {3.794904330451049*^9, 
  3.7949044355368013`*^9}, {3.7949046659516773`*^9, 
  3.794904731509088*^9}, {3.794904994327477*^9, 3.794904994781458*^9}}]

'''

$\endgroup$
  • 4
    $\begingroup$ This kind of problem is hard to debug without Cell or Notebook code. I suggest you select the expression, then use menu Edit > Copy As... > Cell Expression and then paste that code at the bottom of your Question. $\endgroup$ – Mr.Wizard Apr 3 '20 at 12:25
  • 1
    $\begingroup$ The last two matrices are somehow part of a grid/matrix themselves (notice how you cannot select just the 3rd-to-last and 2nd-to-last matrices, the last one is always selected as well). The easiest fix is to simply copy out the last two matrices (each one individually), then delete this invisible grid with the last two matrices and paste them back. $\endgroup$ – Lukas Lang Apr 3 '20 at 12:46
2
$\begingroup$

As noted in the comments, there is some kind of invisible table/grid wrapped around the last two matrices, which causes the issue. You can see this by trying to select one matrix after the other - the last two are always selected together. Cutting them both separately, removing the last two commas and retyping that part fixes the issue:

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.