Notation: How to indicate a segment of vector

105 Views Asked by At

How to note a segment (a part) of a larger vector?

Say I have

$$ \vec{x} = \begin{pmatrix}x_1 & x_2 & x_3 & x_4 & x_5\end{pmatrix} $$

And I want to extract a specific section:

$$ \vec{y} = \begin{pmatrix}x_2 & x_3 & x_4\end{pmatrix} $$

Is there a clear and generally accepted notation for this?
Basically what in MATLAB or Python would be y = x[2:4].

Would any reader understand $y=x_{2:4}$?

4

There are 4 best solutions below

2
On BEST ANSWER

We can represent the vector $\vec{x}$ using index notation: \begin{align*} \vec{x}=\left(x_j\right)_{1\leq j \leq 5} \end{align*} The vector $\vec{y}$ can then be written as \begin{align*} \vec{y}=\left(x_j\right)_{2\leq j\leq 4} \end{align*} In general we can write using index sets $S\subset T$: \begin{align*} \vec{x}=\left(x_j\right)_{j\in T}\qquad\qquad \vec{y}=\left(x_j\right)_{j\in S} \end{align*}

2
On

You can write $y= Px$, where $P$ is the projection operator to the subspace you wish (the $x_2,x_3,x_4$ space in your example).

An equivalent expression would be $\vec{y} = (\vec{x} \cdot \hat{x}_2)\hat{x}_2+\dotsb $

Using the second method, we should denote the coordinates in the space of $\vec{y}$ differently: $u_1,u_2,\dotsc$, so in your example we actually have: $$ \vec{y} = (\vec{x} \cdot \hat{x}_2)\hat{u}_1+ (\vec{x} \cdot \hat{x}_3)\hat{u}_2+ (\vec{x} \cdot \hat{x}_4)\hat{u}_3. $$

0
On

The mapping $$\begin{pmatrix}x_1 \\ x_2 \\ x_3 \\ x_4 \\ x_5\end{pmatrix} \to \begin{pmatrix} x_2 \\ x_3 \\ x_4 \end{pmatrix} $$ is linear, so there is a matrix that represents this linear mapping:

$$\begin{pmatrix}0&1&0&0&0 \\ 0&0&1&0&0 \\ 0&0&0&1&0 \end{pmatrix}\begin{pmatrix}x_1 \\ x_2 \\ x_3 \\ x_4 \\ x_5\end{pmatrix} = \begin{pmatrix} x_2 \\ x_3 \\ x_4 \end{pmatrix} $$


I would not expect that a reader understands $y=x_{2:4}$ but you can define your symbols before you use them.

0
On

A friend of mine, faced with $$ f : X \to Y \tag{1}\\ A \subset X $$ would write $$ f|A : A \to Y \tag{2} $$ to indicate the restriction of $f$ to the subset $A$, an operation that came up frequently in topology. I think that if you defined $2:4$ to mean the segment of the natural numbers between $2$ and $4$ (inclusive), you could write $$ (x|2:4) $$ without a lot of ambiguity, although it's not pretty.

One problem is that the colon is already used in function notation, as in equation 1 above; another is that one wants the "|" operator to bind tightly, so that you can write things like $$ f|A \times g| B $$ for a product of restricted functions. That means you'd need to write $$ x|(2:4) $$ which is even less pretty. And if you wanted to indicate that this restricted thing took values in the reals, you'd need to write $$ x|(2:4) : (2:4) \to \Bbb R $$ which is downright ugly.

In short: you can use this "colon" notation (if you define it carefully), but it's likely to ugly up your writing a bit. This is the rare case where I'd favor subscript notation over the kind of functional notation in equation 2 above.