# How do I describe summations across sets of data?

Assume that there are several geographical regions and within each region there may be many buildings. Buildings may or may not be created and destroyed from time to time hence the requirement to capture the total building area at a point in time (i.e., month).

I want to write the following in shorthand notation if possible.

Sum of the area of all buildings within a region that existed for a given month.

More generally I frequently need to describe various summations across sets of data (building areas, building energy consumption, etc) where the set is not a set of integers but a set of objects constrained by another set.

Is there a clear and succinct way to describe this mathematically and not through prose?

-
You could express each building's area as a function $f$ from tuples in $A \subset B \times R \times T$ to $\mathbb{R}$, where $B$ is the set of buildings, $T$ of time points, $R$ regions, and $A$ of actual historical tuples; $f(b,r,t)$ would be the area of building $b\in B$ from region $r\in R$ at time $t\in T$ and $F(r,t)=\sum_{(b,r,t)\in A}f(b,r,t)$ would be the historical development measured in building area of a particular region at a particular point in time. This is very close also to the way you might model it in SQL, but formulated set-theoretically. – bgins Mar 29 '12 at 18:58

Let's assume that the regions are indexed as ${\cal R} = \{1, \ldots, R\},$ and months are indexed as ${\cal M} = \{1, \ldots, M\},$ and buildings are indexed as ${\cal B} = \{ 1, \ldots, B \}.$ I will use lower case $r \in {\cal R}$ (resp. $m \in {\cal M}$, $b \in {\cal B}$) to denote a given region (resp. month, building).

I am assuming you are storing some relationship between regions, buildings and months. Define the membership predicate: $$\delta: {\cal R} \times {\cal M} \times {\cal B} \to \{0, 1\}$$ such that $$\delta(r, m, b) = \begin{cases} 1, & b \text{ existed during month } m \text{ at region }r \\ 0, & \text{otherwise}\end{cases}$$

Now to interpret sentence like:

Sum of the area of all buildings within a region that existed for a given month.

we could say, given a month $\mathfrak m$ and region $\mathfrak r,$ we have: $$\sum_{b = 1}^{B} \left[ \delta(\mathfrak r, \mathfrak m, b)\, A(b) \right],$$ where $A(b)$ gives the area of a building $b.$ Note that even though the sum is over all buildings, the binary natures of $\delta(\mathfrak r, \mathfrak m, b)$ will zero out the buildings which did not exist at $\mathfrak r$ during month $\mathfrak{m}.$

-
In other words, you represent each building as a point in a 3D space of (region_ID, month_ID, building_ID). – user2468 Mar 29 '12 at 19:06

This is a slight generalization of J.D.'s answer.

Let $X$ be the set of all buildings for which you have data (or, if you were omniscient, it might as well be the set of all buildings that have ever existed and will ever exist).

A region simply consists of a subset $Y\subseteq X$ (any information about the region other than which buildings it contains / contained / will contain is essentially irrelevant).

Let $T$ represent the set of times associated to your data (it's no problem if you data is collected irregularly, or has gaps). Then your data consists of a function $$f:X\times T\to\{0,1\}$$ defined by $$f(x,t)=\begin{cases}1\text{ if building } x\text{ exists at time }t,\\ 0\text{ if building }x\text{ does not exist at time }t.\end{cases}$$ Let's say that the function $A:X\to\mathbb{R}_{\geq0}$ from the set of buildings to the nonnegative real numbers assigns each building its area.

The sum of the areas of all buildings within a region $Y\subseteq X$ that existed for a given range of time $S\subseteq T$ may then be represented as $$\sum_{x\in Y}A(x)\cdot\prod_{t\in S}f(x,t).$$

-