Notation for vector composed of subset of elements of another vector Suppose I have a vector $\boldsymbol{x} = (x_1,x_2,\ldots,x_N)$ in $\mathbb{R}^N$.  I need to express a function $\boldsymbol{y} : \mathbb{R}^N \mapsto \mathbb{R}^{M(\boldsymbol{x})}$ where $M(\boldsymbol{x}) \le N$ such that the vector $\boldsymbol{y}(\boldsymbol{x})$ contains the elements of $\boldsymbol{x}$ that are not equal to some constant $q \in \mathbb{R}$.
For example, if $$\boldsymbol{x}=(23, 17, 1, 99, 122, 17, 40)$$ and $q=17$, then $$ \boldsymbol{y}(\boldsymbol{x})=(23,1,99,122,40).$$
But I'm struggling with how to define this function $\boldsymbol{y}$.  In particular, it is important that the ordering of the elements in $\boldsymbol{y}$ be the same as the ordering of the same elements in $\boldsymbol{x}$, but I don't know how notationally to express this.
How could I define this function?
 A: The question is surprisingly non-trivial. Here's the simplest answer I've been able to come up with; we begin with a couple of definitions.
Definition 0. If $\alpha$ is a well-ordered set and $A$ is a subset of $\alpha$, then let us write $A^*$ for the corresponding canonical function $\mathrm{ord}(A) \rightarrow \alpha$.
Definition 1. Let $X$ denote an arbitrary set, and suppose $\alpha$ is a well-ordered set. Then given a function $f : \alpha \rightarrow X$ and a subset $B$ of $X$, define that $f \vartriangle B = f \circ (f^{-1}(B))^*.$
We're now in a position to give a formal answer to your question, namely the following. If $\boldsymbol{x} \in \mathbb{R}^\alpha$ and $q \in \mathbb{R}$, then the entity of interest can be defined as follows.
$$\boldsymbol{x} \vartriangle (\mathbb{R} \setminus \{q\})$$
Of course this is quite complicated, so you should explain to the reader first the idea of the definition (as, for example, in Josh Chen's answer, with the example you give in your question) before going to the formal viewpoint.
A: In general, if you find no (reasonably) straightforward way to cast a conceptually straightforward definition in common  mathematical notation, it's probably best to just state in words what you'd like the thing you're defining to be, and give an enlightening example.
In this case you'd probably want something like

Let $\hat{\mathbf{x}}_q$ be the vector consisting of the entries of $\mathbf{x}$ not equal to $q$, with the original ordering maintained.

And don't forget to say what $\widehat{(q,\dotsc,q)}_q$ should be.
(I stress that this advice only applies in general to conceptually straightforward definitions, where to give an entirely formal definition would only cause confusion and muddy what should have been a clearcut idea. Of course if you'd like to be more formal see user18921's answer or my comment beneath it.)
