Summation with variables in limit

asked 2016-11-23 09:04:08 -0500

Michael Y gravatar image

Hi, I am new to Sage (and programming for that matter). I would like to sum (a1 +a3)(a1+a4)(a2+a3)(a2+a4) over all non-negative integers a1, a2, a3, a4 which satisfy 2a1 + a3 + a4 less-than D and 2a1 + a3 + a4 less-than D. Of course, my answer should be in terms of D (I have already declared D as a variable).

I have tried using the standard sum function, but that doesn't seem to work over more than one variable. I could try writing my sum as several sums, each over a single variable, but that seems tedious. Does sage allow for more complicated summations like the one I would like to calculate? If so, I would be grateful for an example.

I have tried searching for similar questions on this site, as well as google searching, but I have had no success.

Thank you.

edit retag flag offensive close merge delete


"2a1 + a3 + a4 less-than D and 2a1 + a3 + a4 less-than D" is redundant, perhaps did you make a typo.

tmonteil gravatar imagetmonteil ( 2016-11-23 19:15:21 -0500 )edit