how to write matrix?
Clash Royale CLAN TAG#URR8PPP
up vote
1
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
1
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
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 avoidFor
â 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
add a comment |Â
up vote
1
down vote
favorite
up vote
1
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 43 mins ago
New contributor
asked 1 hour ago
a b
112
112
New contributor
New contributor
2
Check outTable
, and don't forget to capitalizeSin
andCos
.
â 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 avoidFor
â 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
add a comment |Â
2
Check outTable
, and don't forget to capitalizeSin
andCos
.
â 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 avoidFor
â 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
add a comment |Â
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
]
add a comment |Â
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
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
17 mins ago
Good point! I added a comment above to separate the calculated result from the presentation.
â FredrikD
15 mins ago
add a comment |Â
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
]
add a comment |Â
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
]
add a comment |Â
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
]
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 28 mins ago
Henrik Schumacher
43.8k263129
43.8k263129
add a comment |Â
add a comment |Â
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
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
17 mins ago
Good point! I added a comment above to separate the calculated result from the presentation.
â FredrikD
15 mins ago
add a comment |Â
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
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
17 mins ago
Good point! I added a comment above to separate the calculated result from the presentation.
â FredrikD
15 mins ago
add a comment |Â
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
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 14 mins ago
answered 25 mins ago
FredrikD
8071822
8071822
2
Oh please, leave awayMatrixForm
. 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
add a comment |Â
2
Oh please, leave awayMatrixForm
. 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
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-to-write-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
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