Addition with sets and integers

136 Views Asked by At

I've been looking all over the internet for an answer to this question, but it usually just brings up Python related subjects and not anything remotely close to my question.

I basically want to know if it's possible to add the collective sum of a set to an integer. For example I would have B, whose value is 10. Then I have set C, which contains 5, 10, 20.

What I basically am looking for is the correct way to write B + C = 45.

Sorry if I'm using the incorrect terminology, mathematics are not my strongest subject and the terminology I know is all in Dutch and often poorly translates to English.

Thanks for your help.

ps: Before anyone asks; this isn't for homework, it's for a personal project I'm working on.

1

There are 1 best solutions below

2
On BEST ANSWER

The way to obtain $45$ from your sets is to compute $$ \sum_{x\in B} x+\sum_{x\in C} x.$$ Or you could start by defining a function $\Sigma$ from the set of finite subsets of $\mathbb Z$ to $\mathbb Z$ that sends $A$ to $\Sigma(A):=\sum_{x\in A} x$. Then your "$B+C$" is in fact simply $\Sigma(B)+\Sigma(C)$ (which is not the same as $\Sigma(B\cup C)$).

EDIT: I wrote the above under the assumption that $B=\{10\}$. However if $B=10$ directly, than we deal with $B+\Sigma(C)$.