- #1
brydustin
- 205
- 0
Trying to define the size of a matrix by making a zero matrix then adding elements to it (piece by piece in a loop).
Here is the general idea:
U = ConstantArray[0, {3, 3}] // MatrixForm
U[[2, 2]] = 2
(except in the actual code, I would use U[[i,j]] , for example).
My error message is:
Set::noval: Symbol U in part assignment does not have an immediate value. >>
I suspect that it is treating it as a tensor but why? (i.e. U[[2,2]] assigns a value to the second dimension of the tensor, and to the second row (without specifiing column)).
But why? If I check the dimension I get the empty set!
Dimensions
output = {}
what's going on here?
Here is the general idea:
U = ConstantArray[0, {3, 3}] // MatrixForm
U[[2, 2]] = 2
(except in the actual code, I would use U[[i,j]] , for example).
My error message is:
Set::noval: Symbol U in part assignment does not have an immediate value. >>
I suspect that it is treating it as a tensor but why? (i.e. U[[2,2]] assigns a value to the second dimension of the tensor, and to the second row (without specifiing column)).
But why? If I check the dimension I get the empty set!
Dimensions
output = {}
what's going on here?