Why is this replacement not performed the first time?
- To: mathgroup at smc.vnet.net
- Subject: [mg44128] Why is this replacement not performed the first time?
- From: "Steven T. Hatton" <hattons at globalsymmetry.com>
- Date: Thu, 23 Oct 2003 07:16:05 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
When I evaluate the following expression, I get the error shown subsequently: Table[locations[[i1]][[j1]][[k1]]/. Flatten[Table[{i1 -> i + i2, j1 -> j + j2, k1 -> k + k2}, {i2, -1, 1, 2}, {j2, -1, 1, 2}, {k2, -1, 1, 2}], 2] , {i, 2, 4}, {j, 2, 4}, {k, 2, 4}] \!\(\* RowBox[{\(Part::"pspec"\), \(\(:\)\(\ \)\), "\<\"Part specification \ \\!\\(i1\\) is neither an integer nor a list of integers. \\!\\( \*ButtonBox[\ \\\"More\[Ellipsis]\\\", ButtonStyle->\\\"RefGuideLinkText\\\", \ ButtonFrame->None, ButtonData:>\\\"General::pspec\\\"]\\)\"\>"}]\) After the error, I get the table I expect from the statement. Why am I getting this error? Is it because Mathematica is doing some kind of syntax checking before executing? -- "Philosophy is written in this grand book, The Universe. ... But the book cannot be understood unless one first learns to comprehend the language... in which it is written. It is written in the language of mathematics, ...; without which wanders about in a dark labyrinth." The Lion of Gaul