- #1
Rjah
- 1
- 0
Hi,
I ran this program:
P = Table[Subscript[p, i, j], {i, 0, 3}, {j, 0, 2}]
For[j = 0; i=0, j <= 2, j++, Subscript[p, i, j] = 2]
MatrixForm[P]
What is gives me is this:
2 2 2
p[1,0] p[1,1] p[1,2]
p[2,0] p[2,1] p[2,2]
p[3,0] p[3,1] p[3,2]
If I change the program and rerun it:
Clear[p]
P = Table[Subscript[p, i, j], {i, 0, 3}, {j, 0, 2}]
For[j = 0; i=1, j <= 2, j++, Subscript[p, i, j] = 2]
MatrixForm[P]
Now it gives me:
2 2 2
1 1 1
p[2,0] p[2,1] p[2,2]
p[3,0] p[3,1] p[3,2]
I was expecting something like:
p[0,0] p[0,1] p[0,2]
1 1 1
p[2,0] p[2,1] p[2,2]
p[3,0] p[3,1] p[3,2]
I want mathematica to erase its memory from the previous run, but nothing seems to work!
Any suggestions?
I ran this program:
P = Table[Subscript[p, i, j], {i, 0, 3}, {j, 0, 2}]
For[j = 0; i=0, j <= 2, j++, Subscript[p, i, j] = 2]
MatrixForm[P]
What is gives me is this:
2 2 2
p[1,0] p[1,1] p[1,2]
p[2,0] p[2,1] p[2,2]
p[3,0] p[3,1] p[3,2]
If I change the program and rerun it:
Clear[p]
P = Table[Subscript[p, i, j], {i, 0, 3}, {j, 0, 2}]
For[j = 0; i=1, j <= 2, j++, Subscript[p, i, j] = 2]
MatrixForm[P]
Now it gives me:
2 2 2
1 1 1
p[2,0] p[2,1] p[2,2]
p[3,0] p[3,1] p[3,2]
I was expecting something like:
p[0,0] p[0,1] p[0,2]
1 1 1
p[2,0] p[2,1] p[2,2]
p[3,0] p[3,1] p[3,2]
I want mathematica to erase its memory from the previous run, but nothing seems to work!
Any suggestions?