# Is there a computationally efficient way to find the part of a vector, which is of certain order in independent variable x?

Let $\vec{a}$ be an element of a vector space over the space of monomials, i.e.

$$\vec{a}\left(x\right)=\sum_{j=1}^{N}a_jx^{k_{j}}\vec{e_{j}}$$

Remark: For simplicity, here we operate with only one independent variable $x$, but the actual problem has $v$ independent variables. The basis $\vec{e_{j}}$ has nothing to do with the independent variable $x$; it's a basis (possibly, by abuse of notation) in a different space (which is $_{n}D_{v}$, and here $v=1$).

The problem is to find the part of vector $\vec{a}\left(x\right)$, components of which are of the order $k$ in variable $x$. In other words, we need to find the projection of $\vec{a}\left(x\right)$ on $\left(M_{k}\right)^{N}$, where $M_{k}$ is the space of monomials of order $k$, which is

$$\vec{b}\left(x\right)=\sum_{j=1}^{N}\delta_{k_{j}k}a_jx^{k_{j}}\vec{e_{j}}$$

A requirement is to do this using some sort of simple operations such as vector multiplication, addition, integration, et cetera -- within the set of possible operations of a certain programming language. Any 'simple' idea you may suggest is likely to be implementable; however, accessing the vector components one-by-one is considered too computationally expensive, as $N$ is quite large.

I know that it is possible to do using some trickery using a relatively large number of operations, including integration, derivation, and order manipulation; however, that is quite computationally intensive.

Please share your ideas on how to do this in a simple way, which is not computationally intensive.

The alternative I am considering requires submitting a change request to the developers of the specialized programming language I am doing this in.