Re: Why is this replacement not performed the first time?
- To: mathgroup at smc.vnet.net
- Subject: [mg44152] Re: Why is this replacement not performed the first time?
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Fri, 24 Oct 2003 04:24:25 -0400 (EDT)
- Organization: Universitaet Leipzig
- References: <bn8f6a$nmh$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
- Sender: owner-wri-mathgroup at wolfram.com
Hi, no it is because in a /. q->r a is evaluated before the replacement is done. Regards Jens "Steven T. Hatton" wrote: > > 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