How do I write this matrix?

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











up vote
2
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
    8 hours ago






  • 4




    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
    8 hours ago










  • It is edited @Szabolcs
    – a b
    7 hours ago







  • 3




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










  • Please post the code as text (not an image).
    – Peter Mortensen
    2 hours ago














up vote
2
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
    8 hours ago






  • 4




    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
    8 hours ago










  • It is edited @Szabolcs
    – a b
    7 hours ago







  • 3




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










  • Please post the code as text (not an image).
    – Peter Mortensen
    2 hours ago












up vote
2
down vote

favorite









up vote
2
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 12 mins ago









Peter Mortensen

32427




32427






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 8 hours ago









a b

162




162




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
    8 hours ago






  • 4




    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
    8 hours ago










  • It is edited @Szabolcs
    – a b
    7 hours ago







  • 3




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










  • Please post the code as text (not an image).
    – Peter Mortensen
    2 hours ago












  • 2




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






  • 4




    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
    8 hours ago










  • It is edited @Szabolcs
    – a b
    7 hours ago







  • 3




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










  • Please post the code as text (not an image).
    – Peter Mortensen
    2 hours ago







2




2




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




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




4




4




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
8 hours 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
8 hours ago












It is edited @Szabolcs
– a b
7 hours ago





It is edited @Szabolcs
– a b
7 hours ago





3




3




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












Please post the code as text (not an image).
– Peter Mortensen
2 hours ago




Please post the code as text (not an image).
– Peter Mortensen
2 hours ago










2 Answers
2






active

oldest

votes

















up vote
4
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
















  • 1




    +1 Or slightly shorter Table[If[OddQ[j], Cos, Sin][2. Pi i j/(2 n + 1)], i, -n, n, j, 2 n]
    – Bob Hanlon
    5 hours ago

















up vote
4
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
    7 hours ago










  • Good point! I added a comment above to separate the calculated result from the presentation.
    – FredrikD
    7 hours 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-do-i-write-this-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
4
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
















  • 1




    +1 Or slightly shorter Table[If[OddQ[j], Cos, Sin][2. Pi i j/(2 n + 1)], i, -n, n, j, 2 n]
    – Bob Hanlon
    5 hours ago














up vote
4
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
















  • 1




    +1 Or slightly shorter Table[If[OddQ[j], Cos, Sin][2. Pi i j/(2 n + 1)], i, -n, n, j, 2 n]
    – Bob Hanlon
    5 hours ago












up vote
4
down vote










up vote
4
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 7 hours ago









Henrik Schumacher

43.9k263129




43.9k263129







  • 1




    +1 Or slightly shorter Table[If[OddQ[j], Cos, Sin][2. Pi i j/(2 n + 1)], i, -n, n, j, 2 n]
    – Bob Hanlon
    5 hours ago












  • 1




    +1 Or slightly shorter Table[If[OddQ[j], Cos, Sin][2. Pi i j/(2 n + 1)], i, -n, n, j, 2 n]
    – Bob Hanlon
    5 hours ago







1




1




+1 Or slightly shorter Table[If[OddQ[j], Cos, Sin][2. Pi i j/(2 n + 1)], i, -n, n, j, 2 n]
– Bob Hanlon
5 hours ago




+1 Or slightly shorter Table[If[OddQ[j], Cos, Sin][2. Pi i j/(2 n + 1)], i, -n, n, j, 2 n]
– Bob Hanlon
5 hours ago










up vote
4
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
    7 hours ago










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














up vote
4
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
    7 hours ago










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












up vote
4
down vote










up vote
4
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 7 hours ago

























answered 7 hours ago









FredrikD

8371822




8371822







  • 2




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










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












  • 2




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










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







2




2




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




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












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




Good point! I added a comment above to separate the calculated result from the presentation.
– FredrikD
7 hours 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-do-i-write-this-matrix%23new-answer', 'question_page');

);

Post as a guest













































































Comments

Popular posts from this blog

Long meetings (6-7 hours a day): Being “babysat” by supervisor

Is the Concept of Multiple Fantasy Races Scientifically Flawed? [closed]

Confectionery