How to properly get the sum of products for all elements of a set

54 Views Asked by At

I'd like to express the following:

Sum up all products of a and b of all elements in a set. To be a little more specific:

Let's says we have employees that have a certain rate and worked a certain amount of hours. Now I'd like to receive the sum of all products of rate and worked hours.

$$\sum \forall E \in Employees: Hours(E)*Rate(E)$$

Another method I found would be:

$$\sum_{E_i \in Employees} Hours(E_i) * Rate(E_i)$$

So method one feels more intuitive while method two seems to be more accurate. What is the proper way to express this?

1

There are 1 best solutions below

0
On BEST ANSWER

Method two is typically the more appropriate one, at least in spirit, though both notations are cumbersome when you express variables/sets in terms of full words like that. There's also no need to index the members of the set of employees since it's implied you're summing over the whole set in the first place. You could use indices if using the

$$\sum_{i=1}^n (...)$$

type of notation though. (Assuming $n$ employees.)


Personally, I would let $E$ denote the set of employees, $H(e)$ be the hours worked by an employee $e$, and their hourly rate be $R(e)$. Then the sum is succinctly given by

$$\sum_{e \in E} H(e)\cdot R(e)$$

or if you prefer indexing,

$$\sum_{i=1}^n H(e_i)\cdot R(e_i)$$

where $e_i \in E$ for $i=1,2,...,n$ is understood.