涉及因变量的多重和

时间:2014-08-04 02:16:58

标签: sum sympy

同情

summation(120*factorial(2*x1)*factorial(2*x2)*factorial(2*x3)*factorial(-2*x1 - 2*x2 - 2*x3 + 10)/(factorial(x1)*factorial(x2)*factorial(x3)*factorial(-x1 - x2 - x3 + 5)),(x3,1,4-x1-x2),(x2,1,3-x1),(x1,1,2))

给出

Sum(Piecewise((120*(2*factorial(2*x1)*factorial(2*x2)*factorial(-2*x1 - 2*x2 + 8)*hyper((1, 3/2), (x1 + x2 - 7/2,), exp_polar(I*pi))/factorial(-x1 - x2 + 4) - factorial(2*x1)*factorial(2*x2)*factorial(-2*x1 - 2*x2 + 10)*hyper((1, -x1 - x2 + 11/2), (1/2,), exp_polar(I*pi))/factorial(-x1 - x2 + 5))/(factorial(x1)*factorial(x2)), Or(-re(x1) - re(x2) + 6 < 0, And(-re(x1) - re(x2) + 6 < 1, -re(x1) - re(x2) + 6 >= 0))), (120*Sum(factorial(2*x1)*factorial(2*x2)*factorial(2*x3)*factorial(-2*x1 - 2*x2 - 2*x3 + 10)/(factorial(x3)*factorial(-x1 - x2 - x3 + 5)), (x3, 1, -x1 - x2 + 4))/(factorial(x1)*factorial(x2)), True)), (x2, 1, -x1 + 3), (x1, 1, 2))

我怎么能评估这笔钱?我可以对x1和x2做出适当的假设来简化表达式吗?如果是这样,我怎么能这样做?

1 个答案:

答案 0 :(得分:0)

似乎SymPy在这里遗漏了一件非常重要的事情,那就是你的外部总和只在x1 = 1x1 = 2之间。执行简化使得汇总简单到SymPy可以执行它们

In [75]: e = 120*factorial(2*x1)*factorial(2*x2)*factorial(2*x3)*factorial(-2*x1 - 2*x2 - 2*x3 + 10)/(factorial(x1)*factorial(x2)*factorial(x3)*factorial(-x1 - x2 - x3 + 5))

In [76]: e2 = Sum(e, (x3,1,4-x1-x2),(x2,1,3-x1)).subs(x1, 1) + Sum(e, (x3,1,4-x1-x2),(x2,1,3-x1)).subs(x1, 2)

In [77]: e2.doit()
Out[77]: 46080