Interval for summation function?

1.9k Views Asked by At

I know that you almost always set domains for a summation function $\left( \sum \right)$, but can you also set an interval for that domain? Say the domain was 1 to 10, could I set an increment of 0.5 instead of the standard 1? I know that there are ways around this such as setting another variable for the previous number, subtracting 0.5 from the current loop variable, and so on, but is there a way to simply set an interval so that I don't have to do any of that?

2

There are 2 best solutions below

1
On BEST ANSWER

There are mainly two standard ways a summation is used: Iteration over a range of integers, or iteration over a set, e.g. $\sum_{k=2}^\infty f_n$ or $\sum_{x \in S} x$

In your case you could write $\sum_{x \in [1,10] \cap \frac{1}{2} \mathbb Z} x$

0
On

If you set an interval, then you also have to set an increment.

So, in my opinion, it is quite reasonable to write "x=0 to 5 by .1".

However, you have to be careful. If your increment (in this case .1) can not be represented exactly (in binary based floating point), you might not get the last point done or have an additional point (close to 5.1, in this case) handled.

That is why I always use integers and convert to floating point. In this case, I would do "n=0 to 50; x=n/10", so there is no chance of error.