2
$\begingroup$

I want to compute the following multiple summation.

m=1;
n=1;

output = 
  Sum[
    Sum[
      Sum[
        Sum[
          Sum[
            (m-l)!/(k-l+l1)! c^(k+l1-l) a^(m-k-l1) b^l1 (l)!/(l-k+x1)! f^(l-k+x1) d^(k-x1) 1/(i-x1)! g^(i-x1) e^x1,
            {i,0,n-l}],
          {x1,0,k}],
        {l1,0,m-k}],
      {l,0,m}],
    {k,0,m}]

(*a + b c + d + c e + b f + a g + b c g *)

Now declaring the value of $b,c,e,f,g$,

b=0;
c=0;
e=0;
f=0;
g=0;

the output becomes $a+d$. However, I want to evaluate the summation after declaring the value of $b,c,e,f,g$ which results in showing error due to quantities like $0^{-1}$ appear in the summand.

I want to see if mathematica can simplify the summation in form of known special function under the condition $b=c=e=f=g=0$ for general $m, n$.

$\endgroup$
1
  • 1
    $\begingroup$ You can just use one Sum and then include all iteration variable definitions in a series making this better to read. $\endgroup$
    – gwr
    Commented Jan 21, 2019 at 7:22

2 Answers 2

2
$\begingroup$

Use Block. Like so:

m = 1;
n = 1;

b = 0;
c = 0;
e = 0;
f = 0;
g = 0;

output =
  Block[{a, b, c, d, e, f, g},
    Sum[
      Sum[
        Sum[
          Sum[
            Sum[
              (m - l)!/(k - l + l1)! c^(k + l1 - l) a^(m - k - l1) b^l1 (l)!/(l - k + x1)! f^(l - k + x1) d^(k - x1) 1/(i - x1)! g^(i - x1) e^x1, 
              {i, 0, n - l}],
            {x1, 0, k}],
          {l1, 0, m - k}],
        {l, 0, m}],
      {k, 0, m}]]

a + d

$\endgroup$
2
$\begingroup$

The natural way to work with formulas (symbolic) and values (numeric) is to use rules:

m = 1;
n = 1;
parameters = {b, c, e, f, g};
parameterValues = Thread[ parameters -> ConstantArray[0, Length @ parameters] ];

term = Sum[
    (m - l)!/(k - l + l1)! c^(k + l1 - l) a^(m - k - l1) b^l1 (l)!/(l - k + x1)! 
     f^(l - k + x1) d^(k - x1) 1/(i - x1)! g^(i - x1) e^x1,
    (* sequence of summation: i - x1 - l1 - l - k *)
    {k, 0, m},
    {l, 0, m},
    {l1, 0, m - k},
    {x1, 0, k},
    {i, 0, n - l}
];

term /. parameterValues

a + d

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.