How do I write this matrix?
Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
The following code gives 20 data as output.
How can I make a 5*4 matrix by that data list?
matrix programming
New contributor
add a comment |Â
up vote
2
down vote
favorite
The following code gives 20 data as output.
How can I make a 5*4 matrix by that data list?
matrix programming
New contributor
2
Check outTable
, and don't forget to capitalizeSin
andCos
.
â 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 avoidFor
â 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
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
The following code gives 20 data as output.
How can I make a 5*4 matrix by that data list?
matrix programming
New contributor
The following code gives 20 data as output.
How can I make a 5*4 matrix by that data list?
matrix programming
matrix programming
New contributor
New contributor
edited 12 mins ago
Peter Mortensen
32427
32427
New contributor
asked 8 hours ago
a b
162
162
New contributor
New contributor
2
Check outTable
, and don't forget to capitalizeSin
andCos
.
â 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 avoidFor
â 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
add a comment |Â
2
Check outTable
, and don't forget to capitalizeSin
andCos
.
â 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 avoidFor
â 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
add a comment |Â
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
]
1
+1 Or slightly shorterTable[If[OddQ[j], Cos, Sin][2. Pi i j/(2 n + 1)], i, -n, n, j, 2 n]
â Bob Hanlon
5 hours ago
add a comment |Â
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
You can then enter your definition of c and s
2
Oh please, leave awayMatrixForm
. 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
add a comment |Â
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
]
1
+1 Or slightly shorterTable[If[OddQ[j], Cos, Sin][2. Pi i j/(2 n + 1)], i, -n, n, j, 2 n]
â Bob Hanlon
5 hours ago
add a comment |Â
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
]
1
+1 Or slightly shorterTable[If[OddQ[j], Cos, Sin][2. Pi i j/(2 n + 1)], i, -n, n, j, 2 n]
â Bob Hanlon
5 hours ago
add a comment |Â
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
]
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
]
answered 7 hours ago
Henrik Schumacher
43.9k263129
43.9k263129
1
+1 Or slightly shorterTable[If[OddQ[j], Cos, Sin][2. Pi i j/(2 n + 1)], i, -n, n, j, 2 n]
â Bob Hanlon
5 hours ago
add a comment |Â
1
+1 Or slightly shorterTable[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
add a comment |Â
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
You can then enter your definition of c and s
2
Oh please, leave awayMatrixForm
. 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
add a comment |Â
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
You can then enter your definition of c and s
2
Oh please, leave awayMatrixForm
. 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
add a comment |Â
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
You can then enter your definition of c and s
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
You can then enter your definition of c and s
edited 7 hours ago
answered 7 hours ago
FredrikD
8371822
8371822
2
Oh please, leave awayMatrixForm
. 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
add a comment |Â
2
Oh please, leave awayMatrixForm
. 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
add a comment |Â
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.
a b is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
2
Check out
Table
, and don't forget to capitalizeSin
andCos
.â 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