0

Say I want to produce a sum of variable values. But I want the running index, say i, to refer to elements of a set of string, like

$$M=\{{Banana, Bread, Computer}\}$$

such that $$i\in M$$ and that the result somehow resembles

$$\sum_{i\in M}{}x_i$$ In my poorer than fair attempt above the upper boundary is missing and I believe the lower boundary is also inadequate to my goal.

I guess my question in short is: How do I define a sum, where the running index refers to strings rather than integers?

  • Sorry but I don't understand want do you want to do – A. J. Pan-Collantes Jan 13 '23 at 14:41
  • 2
    You can of course iterate over any type of set containing any type of objects. The notation you used $\sum\limits_{i\in M}x_i$ is perfectly acceptable and even common. What is possibly at issue here is whether or not you can actually sum what you want to... It doesn't make sense to talk about Banana + Computer here for instance... though $f(\text{Banana})+f(\text{Computer})$ may make some sort of sense if $f$ were defined in such a way as to have outputs that can be summed. – JMoravitz Jan 13 '23 at 14:42
  • 1
    Your complaints that "the upper boundary is missing" is unfounded. The notation you used is exactly what is normally used. – JMoravitz Jan 13 '23 at 14:43
  • Thanks. I mentioned the upper as well as the lower boundary precisely because I was unsure about the right technical way to go about this. X refers to a binary variable and i specifies the exact binary variable, such that x_banana could be 1, whereas x_computer could be 0, such that the sum would be 1. – RibbitRibbit Jan 13 '23 at 14:46
  • @JMoravitz Yes it does. – RibbitRibbit Jan 13 '23 at 14:46
  • The only thing I'd add further is that you need to be particularly careful for infinite sums and even more careful for summations over uncountably infinite sets in particular. Weird things can happen, especially if your indexing set isn't ordered in an unambiguous way. I'd suggest not worrying about it until it actually becomes relevant to you. – JMoravitz Jan 13 '23 at 14:51

0 Answers0