1

I want to mathematicaly write following split operation.

Given the vector

$X = [x_1, x_2, ..., x_n]$

$Y = split(X, 3) = [ [x_1, x_2, x_3], [x_4, x_5, x_6], \ldots, [x_{n-2}, x_{n-1}, x_n] ]$

So the result is set of sets. The only below come to my mind now:

$Y = \bigcup_{i=1}^{n} \{ \bigcup_{j=1}^{a} x_{(a-1)i+j} \}$

But I guess it is not a proper definition in math. I wonder if there is any existing operator of split command, so I can only write $Y = X \textit{ (split) } 3$, that would be perfect.

Christoph
  • 25,552
nosbor
  • 123
  • 1
    This might be relevant: https://math.stackexchange.com/questions/805565/what-is-the-inverse-of-the-mboxvec-operator – Christoph Sep 03 '20 at 13:14
  • 2
    You won't find this kind of notation/terminology in mathematics. It belongs more in some kind of programming language. Feel free to make up a notation that you find appropriate. – Captain Lama Sep 03 '20 at 13:18
  • 1
    Note that $\bigcup$ usually denotes unions of sets, while you seem to use it as forming tuples. I haven't seen it used like that anywhere else. – Christoph Sep 03 '20 at 13:24
  • @Christoph, thanks, can you explain how I can write it correctly in this case? I would accept such answer if you can write it. – nosbor Sep 03 '20 at 13:29

2 Answers2

1

The $n$-tuple $X=(x_1,x_2,\dots,x_n)$ is usually abbreviated as $X=(x_i)_{i=1}^n$ or $X=(x_i)_{i=1,\dots,n}$. I'm using round parentheses that are more commonly used in mathematics than the brackets for tuples, but you could as well stick with $X=[x_i]_{i=1}^n$ or $X=[x_i]_{i=1,\dots,n}.$

Assuming the length $n$ is divisible by $d$, we can split an $n$-tuple $X=(x_i)_{i=1}^n$ into a $n/d$-tuple of $d$-tuples: $$\big( (x_{(i-1)d+k})_{k=1,\dots,d} \big)_{i=1,\dots,n/d} = \big( (x_{(i-1)d+k})_{k=1}^d \big)_{i=1}^{n/d} = \big((x_1,x_2,\dots,x_d),\dots,(x_{n-d+1},x_{n-d+2},x_n)\big)$$

It might be better suited in this situation to start indices with $0$ instead of $1$ so that the $n$-tuple $X=(x_i)_{i=0}^{n-1}=(x_0,\dots,x_{n-1})$ becomes $$\big( (x_{id+k})_{k=0,\dots,d-1} \big)_{i=0,\dots,n/d-1} = \big( (x_{id+k})_{k=0}^{d-1} \big)_{i=0}^{n/d-1} = ((x_0,x_1,\dots,x_{d-1}),\dots,(x_{n-d},x_{n-d+1},x_{n-1})).$$

In the end, it is up to you to choose a notation (and name for the operation) that best suits your needs.

Christoph
  • 25,552
1

For any positive integer $k,$ let $I_k = \{0, 1, \ldots, k - 1\}.$

For any positive integers $m, p,$ there is a bijection (given as a primitive operation in many programming languages) $$ \alpha \colon I_{mp} \to I_p \times I_m, \ i \mapsto (\left\lfloor i/m \right\rfloor, i - m\cdot\left\lfloor i/m \right\rfloor), $$ with inverse $$ \beta \colon I_p \times I_m \to I_{mp}, \ (q, r) \mapsto mq + r. $$ If $A, B$ are sets, denote the set of all functions $A \to B$ by $[A \to B].$ For any sets $A, B, V,$ there is a bijection, called "currying", $$ \gamma \colon [(A \times B) \to V] \to [A \to [B \to V]], \ f \mapsto ((f(a, b))_{b \in B})_{a \in A}. $$ The "family" notation is ugly, but I don't know of any other established mathematical notation for this. In an equally ugly notation, the inverse of $\gamma$ is $$ \delta \colon [A \to [B \to V]] \to [(A \times B) \to V], \ g \mapsto (g(a)(b))_{a \in A, b \in B}. $$ With $m = 3,$ $n = mp,$ $A = I_p,$ $B = I_3 = \{0, 1, 2\},$ $V$ the set of possible elements of a list, and with a list of $k$ elements being treated as a function $I_k \to V,$ we could write something like $$ \operatorname{split}(X \colon I_{mp} \to V) = \gamma(X \circ \beta) \colon I_p \to [I_m \to V]. $$ This is improvised using almost (but not quite) standard mathematical notation, but I wouldn't be at all surprised if a functional programming language such as Haskell already has an established way to write something like this, without any need for improvisation.