2018-06-29 18:06:30 +0100 | received badge | ● Famous Question (source) |
2014-11-10 16:30:29 +0100 | received badge | ● Notable Question (source) |
2014-04-13 13:44:40 +0100 | received badge | ● Popular Question (source) |
2013-10-30 03:33:58 +0100 | commented answer | Difference between sum and for loop Hi, thank you for your reply. On the first point, k is always an odd integer, and so this is not a problem. I see what you mean about distinguishing between python variables and symbolic variables. The variable that will remain unknown at the end is x, and x is also a parameter for t and s. However I have been testing this out with various values of x for which I know what the answer should be. I seem to have isolated where the problem may lie. I'm not sure if you'd read my comment above: with the functions I've defined before h(3,2,3,1,2) = 0, which is right. However if I do the same calculation with sum I get sum(h(3,t,3,1,2),t,2,2) = -6. This happens for a number of values and is the reason why ... (more) |
2013-10-29 15:14:08 +0100 | commented question | Difference between sum and for loop Ok so I've had a look at it and the problem arises for some specific values in the double sum. For example, with the functions defined above, h(3,2,3,1,2) = 0 which is correct. However, when I try to compute the same value with sum, I get instead sum(h(3,t,3,1,2),t,2,2) = -6. I think this has something to do with the way in which sum evaluates its arguments. I can't work out how to deal with this, if anyone has any ideas I would really appreciate it. |
2013-10-28 13:04:05 +0100 | asked a question | Difference between sum and for loop Hi, I'm currently using sage to calculate some double sums over two variables, where s runs from 1 to t-1, and t runs from 2 to 2x+2n+1. I initially used two nested for loops inside the following function: where i, j, k, x, n are all nonnegative integers. This gives me the correct values for what I am enumerating, for instance qentr(1,3,3,1,2) = 96, which is right. For some reason when I replace these for loops with two nested sums, say, this no longer gives me the correct values. If I replace the two nested loops with this sum I get qentr(1,3,3,1,2)=196.... I wanted to replace the loops with sum in order to return an expression in x, the only way I can think to do this is with sum but this does not yield the right expression. Does anyone know why this happens? Does anyone know an alternative way I can get the function qentr() to return a polynomial in x? The function h from above is the following: Cheers! |