Hello all, I would like some help with the following issue. Consider a fooball (soccer) game. I want to create a function that returns the sum of all the possible outcomes, where one team wins and the total number of goals is less than a given line. For example, team 1 wins, and total goals less than 3.5 would return (1,0), (2,0), (2,1), (3,0). I used the following that works correctly:
line = 3.5;
sum = 0;
For[i = 1, i <= Floor[line], i++,
For[j = 0, And[j < i, i + j < line], j++,
sum = sum + cs[i, j]
]
]
sum
The output of this is:
cs[1, 0] + cs[2, 0] + cs[2, 1] + cs[3, 0]
My question is, how would I rewrite the same, using a double sum: Something like
Sum[cs[i,j],{i,1,Floor[line]},{j,a,b}]
where I am seeking for a
and b
.
Any help would be awsome, thank you in advance.