why doesn't this ReplaceAll work in mathematica
I have
Table[{x1, 1, 2, 3}^i, {i, 0, 3}] /. x1 -> 1/2
But the following does not work, since x1 is not replaced with 1/2
Table[{x1, 1, 2, 3}^i, {i, 0, 3}] // Inverse /. x1 -> 1/2
Could anybody l开发者_JAVA技巧et me know why and how to fix it? Many thanks!
Look at TreeForm
to see how your expression is parsed.
TreeForm@Hold[Table[{x1, 1, 2, 3}^i, {i, 0, 3}] // Inverse /. x1 -> 1/2]
(source: yaroslavvb.com)
Everything after //
is taken to be function head that is applied with Postfix notation. So you need some parentheses
(Table[{x1, 1, 2, 3}^i, {i, 0, 3}] // Inverse) /. x1 -> 1/2
精彩评论