MathGroup Archive 2003

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Why is this replacement not performed the first time?


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


  • Prev by Date: Re: NIntegrate and Delayed Functions
  • Next by Date: [no subject]
  • Previous by thread: Why is this replacement not performed the first time?
  • Next by thread: Re: Why is this replacement not performed the first time?