How to substitute curly brackets with round brackets in a grid of list












2












$begingroup$


I want to produce a table (or a grid) from my list of data, as follows:



eq01={0.01,1.02};
ev01={{1,3},{2,4}};
ev02={{5,5},{6,1}};
data1 = {{"", "Equilibrium points", "Eigenvalues",
"Eigenvectors"}, {"A = 0",eq01,ev01,ev02}};

Grid[data1, Alignment -> Left, Spacings -> {2, 1}, Frame -> All,
ItemStyle -> "Text"]


And what I obtain is the following:



enter image description here



Is there a way to:
1) flatten the lists under "Eigenvalues" and "Eigenvectors" without using flatten for every definition of list in the beginning? Because I have many eigenvalues and eigenvectors and it would be very long;
2) substitute the curly brackets with round brackets, to have for example, in the second column and second row, (0.01,1.02)?



I hope the question is clear, thanks in advance!










share|improve this question











$endgroup$

















    2












    $begingroup$


    I want to produce a table (or a grid) from my list of data, as follows:



    eq01={0.01,1.02};
    ev01={{1,3},{2,4}};
    ev02={{5,5},{6,1}};
    data1 = {{"", "Equilibrium points", "Eigenvalues",
    "Eigenvectors"}, {"A = 0",eq01,ev01,ev02}};

    Grid[data1, Alignment -> Left, Spacings -> {2, 1}, Frame -> All,
    ItemStyle -> "Text"]


    And what I obtain is the following:



    enter image description here



    Is there a way to:
    1) flatten the lists under "Eigenvalues" and "Eigenvectors" without using flatten for every definition of list in the beginning? Because I have many eigenvalues and eigenvectors and it would be very long;
    2) substitute the curly brackets with round brackets, to have for example, in the second column and second row, (0.01,1.02)?



    I hope the question is clear, thanks in advance!










    share|improve this question











    $endgroup$















      2












      2








      2





      $begingroup$


      I want to produce a table (or a grid) from my list of data, as follows:



      eq01={0.01,1.02};
      ev01={{1,3},{2,4}};
      ev02={{5,5},{6,1}};
      data1 = {{"", "Equilibrium points", "Eigenvalues",
      "Eigenvectors"}, {"A = 0",eq01,ev01,ev02}};

      Grid[data1, Alignment -> Left, Spacings -> {2, 1}, Frame -> All,
      ItemStyle -> "Text"]


      And what I obtain is the following:



      enter image description here



      Is there a way to:
      1) flatten the lists under "Eigenvalues" and "Eigenvectors" without using flatten for every definition of list in the beginning? Because I have many eigenvalues and eigenvectors and it would be very long;
      2) substitute the curly brackets with round brackets, to have for example, in the second column and second row, (0.01,1.02)?



      I hope the question is clear, thanks in advance!










      share|improve this question











      $endgroup$




      I want to produce a table (or a grid) from my list of data, as follows:



      eq01={0.01,1.02};
      ev01={{1,3},{2,4}};
      ev02={{5,5},{6,1}};
      data1 = {{"", "Equilibrium points", "Eigenvalues",
      "Eigenvectors"}, {"A = 0",eq01,ev01,ev02}};

      Grid[data1, Alignment -> Left, Spacings -> {2, 1}, Frame -> All,
      ItemStyle -> "Text"]


      And what I obtain is the following:



      enter image description here



      Is there a way to:
      1) flatten the lists under "Eigenvalues" and "Eigenvectors" without using flatten for every definition of list in the beginning? Because I have many eigenvalues and eigenvectors and it would be very long;
      2) substitute the curly brackets with round brackets, to have for example, in the second column and second row, (0.01,1.02)?



      I hope the question is clear, thanks in advance!







      list-manipulation output-formatting grid-layouts






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 12 hours ago









      Michael E2

      150k12203482




      150k12203482










      asked 13 hours ago









      EsperantaEsperanta

      252




      252






















          3 Answers
          3






          active

          oldest

          votes


















          3












          $begingroup$

          Edit

          this works exactly as OP asked in the comments below

          also for many rows



          eq01={0.01,1.02};
          ev01={{1,3},{2,4}};
          ev02={{5,5},{6,1}};
          data1=StringReplace[#,{"{{"->"(","}}"->")","{"->"(","}"->")"}]&/@
          ToString/@#&/@{{"","Equilibrium points","Eigenvalues","Eigenvectors"},{"A = 0",eq01,ev01,ev02}};

          Grid[data1,Alignment->Left,Spacings->{2,1},Frame->All,ItemStyle->"Text"]


          enter image description here






          share|improve this answer











          $endgroup$













          • $begingroup$
            Almost, actually I did not mention clearly that in the eigenvalues and eigenvectors columns I would like to have: (1,3),(2,4) and (5,5),(6,1), so I would need to keep the internal brackets and substitute them with round brackets. Do you know how I could do? And is there a way to write the rule only once for the entire data (which is longer than just this one in reality) and not for every row? Thanks!
            $endgroup$
            – Esperanta
            12 hours ago






          • 1




            $begingroup$
            Esperanta, you said "flatten the lists under "Eigenvalues" and "Eigenvectors"... but now you are changing both of your questions... let me see what I can do. You should also try yourself now that I showed you the basics ;-)
            $endgroup$
            – J42161217
            12 hours ago






          • 1




            $begingroup$
            @Esperanta I updated the answer. Please check it
            $endgroup$
            – J42161217
            12 hours ago



















          3












          $begingroup$

          I think you have to use a custom formatting utility of some sort:



          vectorForm[v_?VectorQ] := Row[{"(", Row[v, ","], ")"}];

          Grid[data1 /. {
          m_?(MatrixQ[#, NumericQ] &) :> Row[vectorForm /@ m, ","],
          v_?(VectorQ[#, NumericQ] &) :> vectorForm[v]},
          Alignment -> Left, Spacings -> {2, 1}, Frame -> All,
          ItemStyle -> "Text"]


          Mathematica graphics



          One distinct advantage of this approach is that it leverages Mathematica's expression formatting capabilities and avoids the lack of robustness of ToString. Compare the above method with @J42161217's on normalized eigenvectors:



          eq01 = {0.01, 1.02};
          ev01 = {{1, 3}, {2, 4}};
          ev02 = Normalize /@ {{5, 5}, {6, 1}};

          (* @MichaelE2 *)
          data2 = {{"", "Equilibrium points", "Eigenvalues",
          "Eigenvectors"}, {"A = 0", eq01, ev01, ev02}};
          Grid[data2 /. {
          m_?(MatrixQ[#, NumericQ] &) :> Row[vectorForm /@ m, ","],
          v_?(VectorQ[#, NumericQ] &) :> vectorForm[v]},
          Alignment -> Left, Spacings -> {2, 1}, Frame -> All,
          ItemStyle -> "Text"]


          Mathematica graphics



          (* @J42161217 *)
          data2 = StringReplace[#, {"{{" -> "(", "}}" -> ")", "{" -> "(",
          "}" -> ")"}] & /@ ToString /@ # & /@ {{"",
          "Equilibrium points", "Eigenvalues", "Eigenvectors"}, {"A = 0",
          eq01, ev01, ev02}};
          Grid[data2, Alignment -> Left, Spacings -> {2, 1}, Frame -> All,
          ItemStyle -> "Text"]


          enter image description here



          Something similar happens with ordinary fractions and square roots.





          Original formatting, in which a set appears in set notation:



          Grid[data1 /. v_?(VectorQ[#, NumericQ] &) :> vectorForm[v], 
          Alignment -> Left, Spacings -> {2, 1}, Frame -> All,
          ItemStyle -> "Text"]


          Mathematica graphics






          share|improve this answer











          $endgroup$













          • $begingroup$
            I think in order to get what OP asks you should replace "{("->"("
            $endgroup$
            – J42161217
            12 hours ago










          • $begingroup$
            @J42161217 Maybe so. I'm not sure, but the OP will clarify, I suppose.
            $endgroup$
            – Michael E2
            12 hours ago










          • $begingroup$
            OP clarified in the comments of my answer. I think you should check it
            $endgroup$
            – J42161217
            12 hours ago










          • $begingroup$
            @J42161217 I had read that. I'm still not sure, since the OP did not say that the outer braces were unwanted. For all I know it's only the interior formatting that matters. Currently my answer shows the set of eigenvectors in standard notation, which may or may not be a more desirable format. It's easy to change. As I said, you may be right, but it's the OP I want to hear from before I change the answer.
            $endgroup$
            – Michael E2
            12 hours ago






          • 1




            $begingroup$
            Yes actually I needed to keep only the internal brackets and make them round. The answer by J42161217 is what I was looking for. Thanks!
            $endgroup$
            – Esperanta
            11 hours ago



















          0












          $begingroup$

          Another possibility is to define a form that automatically formats numeric vectors and numeric matrices as desired:



          MakeBoxes[EigenForm[e_], StandardForm] ^:= Internal`InheritedBlock[
          {MakeBoxes},
          MakeBoxes[m_List?numericVectorQ, StandardForm] := RowBox[
          {"(", MakeBoxes[Row[m, ","], StandardForm], ")"}
          ];
          MakeBoxes[m_List?numericMatrixQ, StandardForm] := RowBox[
          BoxForm`AddCommas @ BoxForm`ListMakeBoxes[m, StandardForm]
          ];
          MakeBoxes[e, StandardForm]
          ]

          SetAttributes[{numericMatrixQ, numericVectorQ}, HoldAll];

          numericMatrixQ[e_]:=MatrixQ[Unevaluated[e], System`Dump`HeldNumericQ]
          numericVectorQ[e_]:=VectorQ[Unevaluated[e], System`Dump`HeldNumericQ]


          Michael's example:



          eq01 = {0.01,1.02};
          ev01 = {{1,3},{2,4}};
          ev02 = Normalize/@{{5,5},{6,1}};

          data2={{"","Equilibrium points","Eigenvalues","Eigenvectors"},{"A = 0",eq01,ev01,ev02}};
          Grid[
          data2,
          Alignment -> Left, Spacings -> {2, 1}, Frame -> All, ItemStyle -> "Text"
          ] //EigenForm



          enter image description here







          share|improve this answer









          $endgroup$














            Your Answer








            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',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f195068%2fhow-to-substitute-curly-brackets-with-round-brackets-in-a-grid-of-list%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            3 Answers
            3






            active

            oldest

            votes








            3 Answers
            3






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            3












            $begingroup$

            Edit

            this works exactly as OP asked in the comments below

            also for many rows



            eq01={0.01,1.02};
            ev01={{1,3},{2,4}};
            ev02={{5,5},{6,1}};
            data1=StringReplace[#,{"{{"->"(","}}"->")","{"->"(","}"->")"}]&/@
            ToString/@#&/@{{"","Equilibrium points","Eigenvalues","Eigenvectors"},{"A = 0",eq01,ev01,ev02}};

            Grid[data1,Alignment->Left,Spacings->{2,1},Frame->All,ItemStyle->"Text"]


            enter image description here






            share|improve this answer











            $endgroup$













            • $begingroup$
              Almost, actually I did not mention clearly that in the eigenvalues and eigenvectors columns I would like to have: (1,3),(2,4) and (5,5),(6,1), so I would need to keep the internal brackets and substitute them with round brackets. Do you know how I could do? And is there a way to write the rule only once for the entire data (which is longer than just this one in reality) and not for every row? Thanks!
              $endgroup$
              – Esperanta
              12 hours ago






            • 1




              $begingroup$
              Esperanta, you said "flatten the lists under "Eigenvalues" and "Eigenvectors"... but now you are changing both of your questions... let me see what I can do. You should also try yourself now that I showed you the basics ;-)
              $endgroup$
              – J42161217
              12 hours ago






            • 1




              $begingroup$
              @Esperanta I updated the answer. Please check it
              $endgroup$
              – J42161217
              12 hours ago
















            3












            $begingroup$

            Edit

            this works exactly as OP asked in the comments below

            also for many rows



            eq01={0.01,1.02};
            ev01={{1,3},{2,4}};
            ev02={{5,5},{6,1}};
            data1=StringReplace[#,{"{{"->"(","}}"->")","{"->"(","}"->")"}]&/@
            ToString/@#&/@{{"","Equilibrium points","Eigenvalues","Eigenvectors"},{"A = 0",eq01,ev01,ev02}};

            Grid[data1,Alignment->Left,Spacings->{2,1},Frame->All,ItemStyle->"Text"]


            enter image description here






            share|improve this answer











            $endgroup$













            • $begingroup$
              Almost, actually I did not mention clearly that in the eigenvalues and eigenvectors columns I would like to have: (1,3),(2,4) and (5,5),(6,1), so I would need to keep the internal brackets and substitute them with round brackets. Do you know how I could do? And is there a way to write the rule only once for the entire data (which is longer than just this one in reality) and not for every row? Thanks!
              $endgroup$
              – Esperanta
              12 hours ago






            • 1




              $begingroup$
              Esperanta, you said "flatten the lists under "Eigenvalues" and "Eigenvectors"... but now you are changing both of your questions... let me see what I can do. You should also try yourself now that I showed you the basics ;-)
              $endgroup$
              – J42161217
              12 hours ago






            • 1




              $begingroup$
              @Esperanta I updated the answer. Please check it
              $endgroup$
              – J42161217
              12 hours ago














            3












            3








            3





            $begingroup$

            Edit

            this works exactly as OP asked in the comments below

            also for many rows



            eq01={0.01,1.02};
            ev01={{1,3},{2,4}};
            ev02={{5,5},{6,1}};
            data1=StringReplace[#,{"{{"->"(","}}"->")","{"->"(","}"->")"}]&/@
            ToString/@#&/@{{"","Equilibrium points","Eigenvalues","Eigenvectors"},{"A = 0",eq01,ev01,ev02}};

            Grid[data1,Alignment->Left,Spacings->{2,1},Frame->All,ItemStyle->"Text"]


            enter image description here






            share|improve this answer











            $endgroup$



            Edit

            this works exactly as OP asked in the comments below

            also for many rows



            eq01={0.01,1.02};
            ev01={{1,3},{2,4}};
            ev02={{5,5},{6,1}};
            data1=StringReplace[#,{"{{"->"(","}}"->")","{"->"(","}"->")"}]&/@
            ToString/@#&/@{{"","Equilibrium points","Eigenvalues","Eigenvectors"},{"A = 0",eq01,ev01,ev02}};

            Grid[data1,Alignment->Left,Spacings->{2,1},Frame->All,ItemStyle->"Text"]


            enter image description here







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited 12 hours ago

























            answered 13 hours ago









            J42161217J42161217

            4,468324




            4,468324












            • $begingroup$
              Almost, actually I did not mention clearly that in the eigenvalues and eigenvectors columns I would like to have: (1,3),(2,4) and (5,5),(6,1), so I would need to keep the internal brackets and substitute them with round brackets. Do you know how I could do? And is there a way to write the rule only once for the entire data (which is longer than just this one in reality) and not for every row? Thanks!
              $endgroup$
              – Esperanta
              12 hours ago






            • 1




              $begingroup$
              Esperanta, you said "flatten the lists under "Eigenvalues" and "Eigenvectors"... but now you are changing both of your questions... let me see what I can do. You should also try yourself now that I showed you the basics ;-)
              $endgroup$
              – J42161217
              12 hours ago






            • 1




              $begingroup$
              @Esperanta I updated the answer. Please check it
              $endgroup$
              – J42161217
              12 hours ago


















            • $begingroup$
              Almost, actually I did not mention clearly that in the eigenvalues and eigenvectors columns I would like to have: (1,3),(2,4) and (5,5),(6,1), so I would need to keep the internal brackets and substitute them with round brackets. Do you know how I could do? And is there a way to write the rule only once for the entire data (which is longer than just this one in reality) and not for every row? Thanks!
              $endgroup$
              – Esperanta
              12 hours ago






            • 1




              $begingroup$
              Esperanta, you said "flatten the lists under "Eigenvalues" and "Eigenvectors"... but now you are changing both of your questions... let me see what I can do. You should also try yourself now that I showed you the basics ;-)
              $endgroup$
              – J42161217
              12 hours ago






            • 1




              $begingroup$
              @Esperanta I updated the answer. Please check it
              $endgroup$
              – J42161217
              12 hours ago
















            $begingroup$
            Almost, actually I did not mention clearly that in the eigenvalues and eigenvectors columns I would like to have: (1,3),(2,4) and (5,5),(6,1), so I would need to keep the internal brackets and substitute them with round brackets. Do you know how I could do? And is there a way to write the rule only once for the entire data (which is longer than just this one in reality) and not for every row? Thanks!
            $endgroup$
            – Esperanta
            12 hours ago




            $begingroup$
            Almost, actually I did not mention clearly that in the eigenvalues and eigenvectors columns I would like to have: (1,3),(2,4) and (5,5),(6,1), so I would need to keep the internal brackets and substitute them with round brackets. Do you know how I could do? And is there a way to write the rule only once for the entire data (which is longer than just this one in reality) and not for every row? Thanks!
            $endgroup$
            – Esperanta
            12 hours ago




            1




            1




            $begingroup$
            Esperanta, you said "flatten the lists under "Eigenvalues" and "Eigenvectors"... but now you are changing both of your questions... let me see what I can do. You should also try yourself now that I showed you the basics ;-)
            $endgroup$
            – J42161217
            12 hours ago




            $begingroup$
            Esperanta, you said "flatten the lists under "Eigenvalues" and "Eigenvectors"... but now you are changing both of your questions... let me see what I can do. You should also try yourself now that I showed you the basics ;-)
            $endgroup$
            – J42161217
            12 hours ago




            1




            1




            $begingroup$
            @Esperanta I updated the answer. Please check it
            $endgroup$
            – J42161217
            12 hours ago




            $begingroup$
            @Esperanta I updated the answer. Please check it
            $endgroup$
            – J42161217
            12 hours ago











            3












            $begingroup$

            I think you have to use a custom formatting utility of some sort:



            vectorForm[v_?VectorQ] := Row[{"(", Row[v, ","], ")"}];

            Grid[data1 /. {
            m_?(MatrixQ[#, NumericQ] &) :> Row[vectorForm /@ m, ","],
            v_?(VectorQ[#, NumericQ] &) :> vectorForm[v]},
            Alignment -> Left, Spacings -> {2, 1}, Frame -> All,
            ItemStyle -> "Text"]


            Mathematica graphics



            One distinct advantage of this approach is that it leverages Mathematica's expression formatting capabilities and avoids the lack of robustness of ToString. Compare the above method with @J42161217's on normalized eigenvectors:



            eq01 = {0.01, 1.02};
            ev01 = {{1, 3}, {2, 4}};
            ev02 = Normalize /@ {{5, 5}, {6, 1}};

            (* @MichaelE2 *)
            data2 = {{"", "Equilibrium points", "Eigenvalues",
            "Eigenvectors"}, {"A = 0", eq01, ev01, ev02}};
            Grid[data2 /. {
            m_?(MatrixQ[#, NumericQ] &) :> Row[vectorForm /@ m, ","],
            v_?(VectorQ[#, NumericQ] &) :> vectorForm[v]},
            Alignment -> Left, Spacings -> {2, 1}, Frame -> All,
            ItemStyle -> "Text"]


            Mathematica graphics



            (* @J42161217 *)
            data2 = StringReplace[#, {"{{" -> "(", "}}" -> ")", "{" -> "(",
            "}" -> ")"}] & /@ ToString /@ # & /@ {{"",
            "Equilibrium points", "Eigenvalues", "Eigenvectors"}, {"A = 0",
            eq01, ev01, ev02}};
            Grid[data2, Alignment -> Left, Spacings -> {2, 1}, Frame -> All,
            ItemStyle -> "Text"]


            enter image description here



            Something similar happens with ordinary fractions and square roots.





            Original formatting, in which a set appears in set notation:



            Grid[data1 /. v_?(VectorQ[#, NumericQ] &) :> vectorForm[v], 
            Alignment -> Left, Spacings -> {2, 1}, Frame -> All,
            ItemStyle -> "Text"]


            Mathematica graphics






            share|improve this answer











            $endgroup$













            • $begingroup$
              I think in order to get what OP asks you should replace "{("->"("
              $endgroup$
              – J42161217
              12 hours ago










            • $begingroup$
              @J42161217 Maybe so. I'm not sure, but the OP will clarify, I suppose.
              $endgroup$
              – Michael E2
              12 hours ago










            • $begingroup$
              OP clarified in the comments of my answer. I think you should check it
              $endgroup$
              – J42161217
              12 hours ago










            • $begingroup$
              @J42161217 I had read that. I'm still not sure, since the OP did not say that the outer braces were unwanted. For all I know it's only the interior formatting that matters. Currently my answer shows the set of eigenvectors in standard notation, which may or may not be a more desirable format. It's easy to change. As I said, you may be right, but it's the OP I want to hear from before I change the answer.
              $endgroup$
              – Michael E2
              12 hours ago






            • 1




              $begingroup$
              Yes actually I needed to keep only the internal brackets and make them round. The answer by J42161217 is what I was looking for. Thanks!
              $endgroup$
              – Esperanta
              11 hours ago
















            3












            $begingroup$

            I think you have to use a custom formatting utility of some sort:



            vectorForm[v_?VectorQ] := Row[{"(", Row[v, ","], ")"}];

            Grid[data1 /. {
            m_?(MatrixQ[#, NumericQ] &) :> Row[vectorForm /@ m, ","],
            v_?(VectorQ[#, NumericQ] &) :> vectorForm[v]},
            Alignment -> Left, Spacings -> {2, 1}, Frame -> All,
            ItemStyle -> "Text"]


            Mathematica graphics



            One distinct advantage of this approach is that it leverages Mathematica's expression formatting capabilities and avoids the lack of robustness of ToString. Compare the above method with @J42161217's on normalized eigenvectors:



            eq01 = {0.01, 1.02};
            ev01 = {{1, 3}, {2, 4}};
            ev02 = Normalize /@ {{5, 5}, {6, 1}};

            (* @MichaelE2 *)
            data2 = {{"", "Equilibrium points", "Eigenvalues",
            "Eigenvectors"}, {"A = 0", eq01, ev01, ev02}};
            Grid[data2 /. {
            m_?(MatrixQ[#, NumericQ] &) :> Row[vectorForm /@ m, ","],
            v_?(VectorQ[#, NumericQ] &) :> vectorForm[v]},
            Alignment -> Left, Spacings -> {2, 1}, Frame -> All,
            ItemStyle -> "Text"]


            Mathematica graphics



            (* @J42161217 *)
            data2 = StringReplace[#, {"{{" -> "(", "}}" -> ")", "{" -> "(",
            "}" -> ")"}] & /@ ToString /@ # & /@ {{"",
            "Equilibrium points", "Eigenvalues", "Eigenvectors"}, {"A = 0",
            eq01, ev01, ev02}};
            Grid[data2, Alignment -> Left, Spacings -> {2, 1}, Frame -> All,
            ItemStyle -> "Text"]


            enter image description here



            Something similar happens with ordinary fractions and square roots.





            Original formatting, in which a set appears in set notation:



            Grid[data1 /. v_?(VectorQ[#, NumericQ] &) :> vectorForm[v], 
            Alignment -> Left, Spacings -> {2, 1}, Frame -> All,
            ItemStyle -> "Text"]


            Mathematica graphics






            share|improve this answer











            $endgroup$













            • $begingroup$
              I think in order to get what OP asks you should replace "{("->"("
              $endgroup$
              – J42161217
              12 hours ago










            • $begingroup$
              @J42161217 Maybe so. I'm not sure, but the OP will clarify, I suppose.
              $endgroup$
              – Michael E2
              12 hours ago










            • $begingroup$
              OP clarified in the comments of my answer. I think you should check it
              $endgroup$
              – J42161217
              12 hours ago










            • $begingroup$
              @J42161217 I had read that. I'm still not sure, since the OP did not say that the outer braces were unwanted. For all I know it's only the interior formatting that matters. Currently my answer shows the set of eigenvectors in standard notation, which may or may not be a more desirable format. It's easy to change. As I said, you may be right, but it's the OP I want to hear from before I change the answer.
              $endgroup$
              – Michael E2
              12 hours ago






            • 1




              $begingroup$
              Yes actually I needed to keep only the internal brackets and make them round. The answer by J42161217 is what I was looking for. Thanks!
              $endgroup$
              – Esperanta
              11 hours ago














            3












            3








            3





            $begingroup$

            I think you have to use a custom formatting utility of some sort:



            vectorForm[v_?VectorQ] := Row[{"(", Row[v, ","], ")"}];

            Grid[data1 /. {
            m_?(MatrixQ[#, NumericQ] &) :> Row[vectorForm /@ m, ","],
            v_?(VectorQ[#, NumericQ] &) :> vectorForm[v]},
            Alignment -> Left, Spacings -> {2, 1}, Frame -> All,
            ItemStyle -> "Text"]


            Mathematica graphics



            One distinct advantage of this approach is that it leverages Mathematica's expression formatting capabilities and avoids the lack of robustness of ToString. Compare the above method with @J42161217's on normalized eigenvectors:



            eq01 = {0.01, 1.02};
            ev01 = {{1, 3}, {2, 4}};
            ev02 = Normalize /@ {{5, 5}, {6, 1}};

            (* @MichaelE2 *)
            data2 = {{"", "Equilibrium points", "Eigenvalues",
            "Eigenvectors"}, {"A = 0", eq01, ev01, ev02}};
            Grid[data2 /. {
            m_?(MatrixQ[#, NumericQ] &) :> Row[vectorForm /@ m, ","],
            v_?(VectorQ[#, NumericQ] &) :> vectorForm[v]},
            Alignment -> Left, Spacings -> {2, 1}, Frame -> All,
            ItemStyle -> "Text"]


            Mathematica graphics



            (* @J42161217 *)
            data2 = StringReplace[#, {"{{" -> "(", "}}" -> ")", "{" -> "(",
            "}" -> ")"}] & /@ ToString /@ # & /@ {{"",
            "Equilibrium points", "Eigenvalues", "Eigenvectors"}, {"A = 0",
            eq01, ev01, ev02}};
            Grid[data2, Alignment -> Left, Spacings -> {2, 1}, Frame -> All,
            ItemStyle -> "Text"]


            enter image description here



            Something similar happens with ordinary fractions and square roots.





            Original formatting, in which a set appears in set notation:



            Grid[data1 /. v_?(VectorQ[#, NumericQ] &) :> vectorForm[v], 
            Alignment -> Left, Spacings -> {2, 1}, Frame -> All,
            ItemStyle -> "Text"]


            Mathematica graphics






            share|improve this answer











            $endgroup$



            I think you have to use a custom formatting utility of some sort:



            vectorForm[v_?VectorQ] := Row[{"(", Row[v, ","], ")"}];

            Grid[data1 /. {
            m_?(MatrixQ[#, NumericQ] &) :> Row[vectorForm /@ m, ","],
            v_?(VectorQ[#, NumericQ] &) :> vectorForm[v]},
            Alignment -> Left, Spacings -> {2, 1}, Frame -> All,
            ItemStyle -> "Text"]


            Mathematica graphics



            One distinct advantage of this approach is that it leverages Mathematica's expression formatting capabilities and avoids the lack of robustness of ToString. Compare the above method with @J42161217's on normalized eigenvectors:



            eq01 = {0.01, 1.02};
            ev01 = {{1, 3}, {2, 4}};
            ev02 = Normalize /@ {{5, 5}, {6, 1}};

            (* @MichaelE2 *)
            data2 = {{"", "Equilibrium points", "Eigenvalues",
            "Eigenvectors"}, {"A = 0", eq01, ev01, ev02}};
            Grid[data2 /. {
            m_?(MatrixQ[#, NumericQ] &) :> Row[vectorForm /@ m, ","],
            v_?(VectorQ[#, NumericQ] &) :> vectorForm[v]},
            Alignment -> Left, Spacings -> {2, 1}, Frame -> All,
            ItemStyle -> "Text"]


            Mathematica graphics



            (* @J42161217 *)
            data2 = StringReplace[#, {"{{" -> "(", "}}" -> ")", "{" -> "(",
            "}" -> ")"}] & /@ ToString /@ # & /@ {{"",
            "Equilibrium points", "Eigenvalues", "Eigenvectors"}, {"A = 0",
            eq01, ev01, ev02}};
            Grid[data2, Alignment -> Left, Spacings -> {2, 1}, Frame -> All,
            ItemStyle -> "Text"]


            enter image description here



            Something similar happens with ordinary fractions and square roots.





            Original formatting, in which a set appears in set notation:



            Grid[data1 /. v_?(VectorQ[#, NumericQ] &) :> vectorForm[v], 
            Alignment -> Left, Spacings -> {2, 1}, Frame -> All,
            ItemStyle -> "Text"]


            Mathematica graphics







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited 7 hours ago

























            answered 12 hours ago









            Michael E2Michael E2

            150k12203482




            150k12203482












            • $begingroup$
              I think in order to get what OP asks you should replace "{("->"("
              $endgroup$
              – J42161217
              12 hours ago










            • $begingroup$
              @J42161217 Maybe so. I'm not sure, but the OP will clarify, I suppose.
              $endgroup$
              – Michael E2
              12 hours ago










            • $begingroup$
              OP clarified in the comments of my answer. I think you should check it
              $endgroup$
              – J42161217
              12 hours ago










            • $begingroup$
              @J42161217 I had read that. I'm still not sure, since the OP did not say that the outer braces were unwanted. For all I know it's only the interior formatting that matters. Currently my answer shows the set of eigenvectors in standard notation, which may or may not be a more desirable format. It's easy to change. As I said, you may be right, but it's the OP I want to hear from before I change the answer.
              $endgroup$
              – Michael E2
              12 hours ago






            • 1




              $begingroup$
              Yes actually I needed to keep only the internal brackets and make them round. The answer by J42161217 is what I was looking for. Thanks!
              $endgroup$
              – Esperanta
              11 hours ago


















            • $begingroup$
              I think in order to get what OP asks you should replace "{("->"("
              $endgroup$
              – J42161217
              12 hours ago










            • $begingroup$
              @J42161217 Maybe so. I'm not sure, but the OP will clarify, I suppose.
              $endgroup$
              – Michael E2
              12 hours ago










            • $begingroup$
              OP clarified in the comments of my answer. I think you should check it
              $endgroup$
              – J42161217
              12 hours ago










            • $begingroup$
              @J42161217 I had read that. I'm still not sure, since the OP did not say that the outer braces were unwanted. For all I know it's only the interior formatting that matters. Currently my answer shows the set of eigenvectors in standard notation, which may or may not be a more desirable format. It's easy to change. As I said, you may be right, but it's the OP I want to hear from before I change the answer.
              $endgroup$
              – Michael E2
              12 hours ago






            • 1




              $begingroup$
              Yes actually I needed to keep only the internal brackets and make them round. The answer by J42161217 is what I was looking for. Thanks!
              $endgroup$
              – Esperanta
              11 hours ago
















            $begingroup$
            I think in order to get what OP asks you should replace "{("->"("
            $endgroup$
            – J42161217
            12 hours ago




            $begingroup$
            I think in order to get what OP asks you should replace "{("->"("
            $endgroup$
            – J42161217
            12 hours ago












            $begingroup$
            @J42161217 Maybe so. I'm not sure, but the OP will clarify, I suppose.
            $endgroup$
            – Michael E2
            12 hours ago




            $begingroup$
            @J42161217 Maybe so. I'm not sure, but the OP will clarify, I suppose.
            $endgroup$
            – Michael E2
            12 hours ago












            $begingroup$
            OP clarified in the comments of my answer. I think you should check it
            $endgroup$
            – J42161217
            12 hours ago




            $begingroup$
            OP clarified in the comments of my answer. I think you should check it
            $endgroup$
            – J42161217
            12 hours ago












            $begingroup$
            @J42161217 I had read that. I'm still not sure, since the OP did not say that the outer braces were unwanted. For all I know it's only the interior formatting that matters. Currently my answer shows the set of eigenvectors in standard notation, which may or may not be a more desirable format. It's easy to change. As I said, you may be right, but it's the OP I want to hear from before I change the answer.
            $endgroup$
            – Michael E2
            12 hours ago




            $begingroup$
            @J42161217 I had read that. I'm still not sure, since the OP did not say that the outer braces were unwanted. For all I know it's only the interior formatting that matters. Currently my answer shows the set of eigenvectors in standard notation, which may or may not be a more desirable format. It's easy to change. As I said, you may be right, but it's the OP I want to hear from before I change the answer.
            $endgroup$
            – Michael E2
            12 hours ago




            1




            1




            $begingroup$
            Yes actually I needed to keep only the internal brackets and make them round. The answer by J42161217 is what I was looking for. Thanks!
            $endgroup$
            – Esperanta
            11 hours ago




            $begingroup$
            Yes actually I needed to keep only the internal brackets and make them round. The answer by J42161217 is what I was looking for. Thanks!
            $endgroup$
            – Esperanta
            11 hours ago











            0












            $begingroup$

            Another possibility is to define a form that automatically formats numeric vectors and numeric matrices as desired:



            MakeBoxes[EigenForm[e_], StandardForm] ^:= Internal`InheritedBlock[
            {MakeBoxes},
            MakeBoxes[m_List?numericVectorQ, StandardForm] := RowBox[
            {"(", MakeBoxes[Row[m, ","], StandardForm], ")"}
            ];
            MakeBoxes[m_List?numericMatrixQ, StandardForm] := RowBox[
            BoxForm`AddCommas @ BoxForm`ListMakeBoxes[m, StandardForm]
            ];
            MakeBoxes[e, StandardForm]
            ]

            SetAttributes[{numericMatrixQ, numericVectorQ}, HoldAll];

            numericMatrixQ[e_]:=MatrixQ[Unevaluated[e], System`Dump`HeldNumericQ]
            numericVectorQ[e_]:=VectorQ[Unevaluated[e], System`Dump`HeldNumericQ]


            Michael's example:



            eq01 = {0.01,1.02};
            ev01 = {{1,3},{2,4}};
            ev02 = Normalize/@{{5,5},{6,1}};

            data2={{"","Equilibrium points","Eigenvalues","Eigenvectors"},{"A = 0",eq01,ev01,ev02}};
            Grid[
            data2,
            Alignment -> Left, Spacings -> {2, 1}, Frame -> All, ItemStyle -> "Text"
            ] //EigenForm



            enter image description here







            share|improve this answer









            $endgroup$


















              0












              $begingroup$

              Another possibility is to define a form that automatically formats numeric vectors and numeric matrices as desired:



              MakeBoxes[EigenForm[e_], StandardForm] ^:= Internal`InheritedBlock[
              {MakeBoxes},
              MakeBoxes[m_List?numericVectorQ, StandardForm] := RowBox[
              {"(", MakeBoxes[Row[m, ","], StandardForm], ")"}
              ];
              MakeBoxes[m_List?numericMatrixQ, StandardForm] := RowBox[
              BoxForm`AddCommas @ BoxForm`ListMakeBoxes[m, StandardForm]
              ];
              MakeBoxes[e, StandardForm]
              ]

              SetAttributes[{numericMatrixQ, numericVectorQ}, HoldAll];

              numericMatrixQ[e_]:=MatrixQ[Unevaluated[e], System`Dump`HeldNumericQ]
              numericVectorQ[e_]:=VectorQ[Unevaluated[e], System`Dump`HeldNumericQ]


              Michael's example:



              eq01 = {0.01,1.02};
              ev01 = {{1,3},{2,4}};
              ev02 = Normalize/@{{5,5},{6,1}};

              data2={{"","Equilibrium points","Eigenvalues","Eigenvectors"},{"A = 0",eq01,ev01,ev02}};
              Grid[
              data2,
              Alignment -> Left, Spacings -> {2, 1}, Frame -> All, ItemStyle -> "Text"
              ] //EigenForm



              enter image description here







              share|improve this answer









              $endgroup$
















                0












                0








                0





                $begingroup$

                Another possibility is to define a form that automatically formats numeric vectors and numeric matrices as desired:



                MakeBoxes[EigenForm[e_], StandardForm] ^:= Internal`InheritedBlock[
                {MakeBoxes},
                MakeBoxes[m_List?numericVectorQ, StandardForm] := RowBox[
                {"(", MakeBoxes[Row[m, ","], StandardForm], ")"}
                ];
                MakeBoxes[m_List?numericMatrixQ, StandardForm] := RowBox[
                BoxForm`AddCommas @ BoxForm`ListMakeBoxes[m, StandardForm]
                ];
                MakeBoxes[e, StandardForm]
                ]

                SetAttributes[{numericMatrixQ, numericVectorQ}, HoldAll];

                numericMatrixQ[e_]:=MatrixQ[Unevaluated[e], System`Dump`HeldNumericQ]
                numericVectorQ[e_]:=VectorQ[Unevaluated[e], System`Dump`HeldNumericQ]


                Michael's example:



                eq01 = {0.01,1.02};
                ev01 = {{1,3},{2,4}};
                ev02 = Normalize/@{{5,5},{6,1}};

                data2={{"","Equilibrium points","Eigenvalues","Eigenvectors"},{"A = 0",eq01,ev01,ev02}};
                Grid[
                data2,
                Alignment -> Left, Spacings -> {2, 1}, Frame -> All, ItemStyle -> "Text"
                ] //EigenForm



                enter image description here







                share|improve this answer









                $endgroup$



                Another possibility is to define a form that automatically formats numeric vectors and numeric matrices as desired:



                MakeBoxes[EigenForm[e_], StandardForm] ^:= Internal`InheritedBlock[
                {MakeBoxes},
                MakeBoxes[m_List?numericVectorQ, StandardForm] := RowBox[
                {"(", MakeBoxes[Row[m, ","], StandardForm], ")"}
                ];
                MakeBoxes[m_List?numericMatrixQ, StandardForm] := RowBox[
                BoxForm`AddCommas @ BoxForm`ListMakeBoxes[m, StandardForm]
                ];
                MakeBoxes[e, StandardForm]
                ]

                SetAttributes[{numericMatrixQ, numericVectorQ}, HoldAll];

                numericMatrixQ[e_]:=MatrixQ[Unevaluated[e], System`Dump`HeldNumericQ]
                numericVectorQ[e_]:=VectorQ[Unevaluated[e], System`Dump`HeldNumericQ]


                Michael's example:



                eq01 = {0.01,1.02};
                ev01 = {{1,3},{2,4}};
                ev02 = Normalize/@{{5,5},{6,1}};

                data2={{"","Equilibrium points","Eigenvalues","Eigenvectors"},{"A = 0",eq01,ev01,ev02}};
                Grid[
                data2,
                Alignment -> Left, Spacings -> {2, 1}, Frame -> All, ItemStyle -> "Text"
                ] //EigenForm



                enter image description here








                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 4 hours ago









                Carl WollCarl Woll

                73.6k398192




                73.6k398192






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Mathematica Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    Use MathJax to format equations. MathJax reference.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f195068%2fhow-to-substitute-curly-brackets-with-round-brackets-in-a-grid-of-list%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Statuo de Libereco

                    Tanganjiko

                    Liste der Baudenkmäler in Enneberg