如何替换聚合表达式
例如,我象征性地
1/n*Sum[ee[k] + 1, {k, j, n}]^2
将 Sum[ee[k], {k, j+1, n}]
替换为 x
。我该怎么做?感谢您的帮助!
For example, I have symbollically
1/n*Sum[ee[k] + 1, {k, j, n}]^2
And I want to substitute Sum[ee[k], {k, j+1, n}]
to be x
. How can I do this? May thanks for your help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用递推关系求和。例如:
Out
Edit
根据您发布的几个问题,我认为您在某种程度上误解了 Replace[] 命令的作用。它不是基于“代数”,而是基于“模式”。它不理解也不使用比已经定义的代数变换(由您或 Mma 本身定义)更多的代数变换。
例如:
不会匹配任何内容。但
会给你 (y-2) 因为模式 x 是匹配的。
此外:
会给你 2 因为 x 在可能的匹配之前被评估,并且模式中的 x 也被评估(只需粘贴,执行并查看符号颜色)。
You may use the recurrence relation for the sum. For example:
Out
Edit
Based on several questions you posted, I think you are somehow misinterpreting what the Replace[] command does. It is not "algebraic" based, but "pattern" based. It doesn't understand nor use more algebraic transformations than those already defined (by you or by Mma itself).
For example:
will not match anything. But
Will give you (y-2) because the pattern x is matched.
Moreover:
will give you 2 because x is evaluated before the possible match, and the x in the pattern is also evaluated (just paste, execute and look at the symbol color).
1/N*Sum[ee[k] + 1, {k, j, N}]^2 /。 Sum[ee[k] + 1, {k, j, N}] -> x
这不起作用,还是我误解了?顺便说一句,您不应该使用 N 作为变量。这是 Mathematica 的一个函数。
1/N*Sum[ee[k] + 1, {k, j, N}]^2 /. Sum[ee[k] + 1, {k, j, N}] -> x
Doesn't that work, or do I misunderstand? By the way, you shouldn't use N as a variable. It's a Mathematica function.