how to write matrix?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












The following code gives 20 data as output.



enter image description here



How can I make a 5*4 matrix by that data list?










share|improve this question









New contributor




a b is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • 2




    Check out Table, and don't forget to capitalize Sin and Cos.
    – Chris K
    1 hour ago






  • 2




    Please post code in code blocks in the future. This is not copyable. I think this will answer all your questions: Why avoid For
    – Szabolcs
    1 hour ago










  • It is edited @Szabolcs
    – a b
    42 mins ago







  • 2




    Hi a-b, when Szabolcs asks for code, he means text that can be copy-pasted. The only way we can fix problems is if we can reproduce them!
    – bill s
    36 mins ago














up vote
1
down vote

favorite












The following code gives 20 data as output.



enter image description here



How can I make a 5*4 matrix by that data list?










share|improve this question









New contributor




a b is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • 2




    Check out Table, and don't forget to capitalize Sin and Cos.
    – Chris K
    1 hour ago






  • 2




    Please post code in code blocks in the future. This is not copyable. I think this will answer all your questions: Why avoid For
    – Szabolcs
    1 hour ago










  • It is edited @Szabolcs
    – a b
    42 mins ago







  • 2




    Hi a-b, when Szabolcs asks for code, he means text that can be copy-pasted. The only way we can fix problems is if we can reproduce them!
    – bill s
    36 mins ago












up vote
1
down vote

favorite









up vote
1
down vote

favorite











The following code gives 20 data as output.



enter image description here



How can I make a 5*4 matrix by that data list?










share|improve this question









New contributor




a b is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











The following code gives 20 data as output.



enter image description here



How can I make a 5*4 matrix by that data list?







matrix programming






share|improve this question









New contributor




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




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








edited 43 mins ago





















New contributor




a b is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 1 hour ago









a b

112




112




New contributor




a b is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





a b is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






a b is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







  • 2




    Check out Table, and don't forget to capitalize Sin and Cos.
    – Chris K
    1 hour ago






  • 2




    Please post code in code blocks in the future. This is not copyable. I think this will answer all your questions: Why avoid For
    – Szabolcs
    1 hour ago










  • It is edited @Szabolcs
    – a b
    42 mins ago







  • 2




    Hi a-b, when Szabolcs asks for code, he means text that can be copy-pasted. The only way we can fix problems is if we can reproduce them!
    – bill s
    36 mins ago












  • 2




    Check out Table, and don't forget to capitalize Sin and Cos.
    – Chris K
    1 hour ago






  • 2




    Please post code in code blocks in the future. This is not copyable. I think this will answer all your questions: Why avoid For
    – Szabolcs
    1 hour ago










  • It is edited @Szabolcs
    – a b
    42 mins ago







  • 2




    Hi a-b, when Szabolcs asks for code, he means text that can be copy-pasted. The only way we can fix problems is if we can reproduce them!
    – bill s
    36 mins ago







2




2




Check out Table, and don't forget to capitalize Sin and Cos.
– Chris K
1 hour ago




Check out Table, and don't forget to capitalize Sin and Cos.
– Chris K
1 hour ago




2




2




Please post code in code blocks in the future. This is not copyable. I think this will answer all your questions: Why avoid For
– Szabolcs
1 hour ago




Please post code in code blocks in the future. This is not copyable. I think this will answer all your questions: Why avoid For
– Szabolcs
1 hour ago












It is edited @Szabolcs
– a b
42 mins ago





It is edited @Szabolcs
– a b
42 mins ago





2




2




Hi a-b, when Szabolcs asks for code, he means text that can be copy-pasted. The only way we can fix problems is if we can reproduce them!
– bill s
36 mins ago




Hi a-b, when Szabolcs asks for code, he means text that can be copy-pasted. The only way we can fix problems is if we can reproduce them!
– bill s
36 mins ago










2 Answers
2






active

oldest

votes

















up vote
2
down vote













n = 2;
Table[
If[OddQ[j],
Cos[2. Pi i j/(2 n + 1)],
Sin[2. Pi i j/(2 n + 1)]
],
i, -n, n, j, 1, 2 n
]





share|improve this answer



























    up vote
    2
    down vote













    Here is a starting point without the For loops:



    Clear@f; 
    f[i_, j_] /; OddQ[j] := c[i, j];
    f[i_, j_] /; EvenQ[j] := s[i, j];

    n1 = 2;
    res = Table[f[i, j], i, -n1, n1, j, 1, 2*n1];

    (* Note MatrixForm is for presentation, not for computations *)
    res // MatrixForm


    enter image description here



    You can then enter your definition of c and s






    share|improve this answer


















    • 2




      Oh please, leave away MatrixForm. It is the cause for so many desperate questions on this forum... (still +1).
      – Henrik Schumacher
      17 mins ago










    • Good point! I added a comment above to separate the calculated result from the presentation.
      – FredrikD
      15 mins ago










    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: 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
    );



    );






    a b 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%2f185272%2fhow-to-write-matrix%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
    2
    down vote













    n = 2;
    Table[
    If[OddQ[j],
    Cos[2. Pi i j/(2 n + 1)],
    Sin[2. Pi i j/(2 n + 1)]
    ],
    i, -n, n, j, 1, 2 n
    ]





    share|improve this answer
























      up vote
      2
      down vote













      n = 2;
      Table[
      If[OddQ[j],
      Cos[2. Pi i j/(2 n + 1)],
      Sin[2. Pi i j/(2 n + 1)]
      ],
      i, -n, n, j, 1, 2 n
      ]





      share|improve this answer






















        up vote
        2
        down vote










        up vote
        2
        down vote









        n = 2;
        Table[
        If[OddQ[j],
        Cos[2. Pi i j/(2 n + 1)],
        Sin[2. Pi i j/(2 n + 1)]
        ],
        i, -n, n, j, 1, 2 n
        ]





        share|improve this answer












        n = 2;
        Table[
        If[OddQ[j],
        Cos[2. Pi i j/(2 n + 1)],
        Sin[2. Pi i j/(2 n + 1)]
        ],
        i, -n, n, j, 1, 2 n
        ]






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 28 mins ago









        Henrik Schumacher

        43.8k263129




        43.8k263129




















            up vote
            2
            down vote













            Here is a starting point without the For loops:



            Clear@f; 
            f[i_, j_] /; OddQ[j] := c[i, j];
            f[i_, j_] /; EvenQ[j] := s[i, j];

            n1 = 2;
            res = Table[f[i, j], i, -n1, n1, j, 1, 2*n1];

            (* Note MatrixForm is for presentation, not for computations *)
            res // MatrixForm


            enter image description here



            You can then enter your definition of c and s






            share|improve this answer


















            • 2




              Oh please, leave away MatrixForm. It is the cause for so many desperate questions on this forum... (still +1).
              – Henrik Schumacher
              17 mins ago










            • Good point! I added a comment above to separate the calculated result from the presentation.
              – FredrikD
              15 mins ago














            up vote
            2
            down vote













            Here is a starting point without the For loops:



            Clear@f; 
            f[i_, j_] /; OddQ[j] := c[i, j];
            f[i_, j_] /; EvenQ[j] := s[i, j];

            n1 = 2;
            res = Table[f[i, j], i, -n1, n1, j, 1, 2*n1];

            (* Note MatrixForm is for presentation, not for computations *)
            res // MatrixForm


            enter image description here



            You can then enter your definition of c and s






            share|improve this answer


















            • 2




              Oh please, leave away MatrixForm. It is the cause for so many desperate questions on this forum... (still +1).
              – Henrik Schumacher
              17 mins ago










            • Good point! I added a comment above to separate the calculated result from the presentation.
              – FredrikD
              15 mins ago












            up vote
            2
            down vote










            up vote
            2
            down vote









            Here is a starting point without the For loops:



            Clear@f; 
            f[i_, j_] /; OddQ[j] := c[i, j];
            f[i_, j_] /; EvenQ[j] := s[i, j];

            n1 = 2;
            res = Table[f[i, j], i, -n1, n1, j, 1, 2*n1];

            (* Note MatrixForm is for presentation, not for computations *)
            res // MatrixForm


            enter image description here



            You can then enter your definition of c and s






            share|improve this answer














            Here is a starting point without the For loops:



            Clear@f; 
            f[i_, j_] /; OddQ[j] := c[i, j];
            f[i_, j_] /; EvenQ[j] := s[i, j];

            n1 = 2;
            res = Table[f[i, j], i, -n1, n1, j, 1, 2*n1];

            (* Note MatrixForm is for presentation, not for computations *)
            res // MatrixForm


            enter image description here



            You can then enter your definition of c and s







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited 14 mins ago

























            answered 25 mins ago









            FredrikD

            8071822




            8071822







            • 2




              Oh please, leave away MatrixForm. It is the cause for so many desperate questions on this forum... (still +1).
              – Henrik Schumacher
              17 mins ago










            • Good point! I added a comment above to separate the calculated result from the presentation.
              – FredrikD
              15 mins ago












            • 2




              Oh please, leave away MatrixForm. It is the cause for so many desperate questions on this forum... (still +1).
              – Henrik Schumacher
              17 mins ago










            • Good point! I added a comment above to separate the calculated result from the presentation.
              – FredrikD
              15 mins ago







            2




            2




            Oh please, leave away MatrixForm. It is the cause for so many desperate questions on this forum... (still +1).
            – Henrik Schumacher
            17 mins ago




            Oh please, leave away MatrixForm. It is the cause for so many desperate questions on this forum... (still +1).
            – Henrik Schumacher
            17 mins ago












            Good point! I added a comment above to separate the calculated result from the presentation.
            – FredrikD
            15 mins ago




            Good point! I added a comment above to separate the calculated result from the presentation.
            – FredrikD
            15 mins ago










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









             

            draft saved


            draft discarded


















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












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











            a b 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%2f185272%2fhow-to-write-matrix%23new-answer', 'question_page');

            );

            Post as a guest













































































            Comments

            Popular posts from this blog

            What does second last employer means? [closed]

            Installing NextGIS Connect into QGIS 3?

            One-line joke