开发者

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]

why doesn't this ReplaceAll work in mathematica


(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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜