1

This is a question about mathematical signs.

Here is a summation:

$$ \sum_{i=k}^{l} x^2 $$

But there is possibility that $l<k$. What should I do? Like a new sign instead of this summation.

My solution: $$ \sum_{i=\min{k,l}}^{\max{k,l}} x^2 $$

Are there more elegant solutions? Any advice is appreciated.

Shaun
  • 44,997
  • 2
    Empty sums evaluate to $0$...is there a problem just using that convention? I note that your approach wouldn't yield that generally, which seems like an error. – lulu May 03 '23 at 14:05
  • @lulu Thanks! Well, I understand that it should be $0$ by convention. But what should I do if I want to do this: $\sum_{i=2}^{1}i=3$? By my solution, though we don't have the exact sorting of $k$ and $l$, we can at least manage to get the sum we want by code. – Xiangyu Cui May 03 '23 at 14:37
  • 1
    @Shaun Thanks for editing! My previous title is stupid, hhh. – Xiangyu Cui May 03 '23 at 14:45
  • 1
    I would say that sum is $0$, as written. You can use your max/min notation to get a sum equal to $3$ if you want, but I would say that this was a different sum. – lulu May 03 '23 at 14:45
  • You're welcome, @XiangyuCui :) – Shaun May 03 '23 at 14:46
  • @lulu Sure, I totally agree with you. And that's actually the exact answer I want, a different summation. Is there one? – Xiangyu Cui May 03 '23 at 15:05
  • I think it's natural to use property $\sum_{i=a}^b x_i + \sum_{i=b + 1}^c x_i = \sum_{i = a}^c x_i$. This gives $\sum_{i=a}^b x_i = -\sum_{i=b+1}^{a - 1} x_i$ and $\sum_{i=a}^{a - 1} x_i = 0$. – mihaild May 03 '23 at 18:13
  • @mihaild Thank you! Do you mean we define $-\sum_{i=b+1}^{a-1}$ as $-\sum_{i=a}^{b}$? Would you mind explaining more? Or is there any reference about this? – Xiangyu Cui May 04 '23 at 02:30
  • 1
    @XiangyuCui I am not sure if they are both minuses in your comment, but I mean to define $\sum_{i=a}^b = -\sum_{i=b+1}^{a - 1}$. I don't have reference at hand, I think I saw this in some material about finite differences. – mihaild May 04 '23 at 09:59
  • @mihaild Thanks! Sorry for the mistake in my comment. Sure, it seems to be a decent definition for difference, though it doesn't go with what i want: $\sum_{i=1}^{2}i=\sum_{i=2}^{1}i=3$. I guess I would just stick to my solution. – Xiangyu Cui May 04 '23 at 13:52
  • Well, you definitely can define $\sum_a^b = \sum_{\min(a, b)}^{\max(a,b)}$. If this is a result you want I doubt there is any other sane definition that gives it. – mihaild May 04 '23 at 15:26
  • @mihaild Get it, thank you! – Xiangyu Cui May 05 '23 at 01:48

0 Answers0