Skip to main content
8 events
when toggle format what by license comment
Mar 30, 2017 at 6:02 comment added Mr.Wizard Related, perhaps duplicate: mathematica.stackexchange.com/q/7214/121
Mar 30, 2017 at 5:53 answer added Mike timeline score: 2
Mar 30, 2017 at 5:49 comment added Marius Ladegård Meyer You can do e.g. m[2] = ReplacePart[m[2], {3, 4} -> 5] but that copies the whole of m[2] so I would prefer @J.M. 's suggestion.
Mar 30, 2017 at 5:43 comment added Marius Ladegård Meyer Also, note the difference between Do and Table, we don't use Table just for side effects ;)
Mar 30, 2017 at 5:42 comment added Marius Ladegård Meyer The docs for the error message just says "Part assignments are implemented only for parts of the value of a symbol." So since m[2] is not a symbol itself, but a reference to one of the DownValues of the symbol m, this is what you get.
Mar 30, 2017 at 5:40 comment added Mike You mean instead of explicitly indexing the matrices, placing them in a list and identifying them there. That does make the way I call the matrices a little more intuitive, I don't have the single brackets and then the double brackets. However, I'm curious why indexing the matrices directly messes with the assignment I make.
Mar 30, 2017 at 5:37 comment added J. M.'s missing motivation Why not do something like m = ConstantArray[0, {5, 3, 3}] and then do m[[2, 3, 4]] = 1?
Mar 30, 2017 at 5:33 history asked Mike CC BY-SA 3.0