# Differentiation of non-commutative polynomials in Sage

Let $f$ be a polynomial in the non-commutative polynomial ring $K[[x_1,..,x_n]]$ in $n$ variables. Define a $K$-linear map for an $i$ with $1 \leq i \leq n$ as $d_i : K[[x_1,..,x_n]] \rightarrow K[[x_1,..,x_n]]$ on monomials as $d_i (f)= g$ if $f=x_i g$ and $d_i (f)= 0$ else, so that this operator simply strikes off the leftmost $x_i$.

Define the $K$-linear (cyclic) differentiation operator for an $i$ with $1 \leq i \leq n$ as $\delta_i: K[[x_1,..,x_n]] \rightarrow K[[x_1,..,x_n]]$ on monomials as $\delta_i ( x_{i_1} \cdots x_{i_t} )= \sum\limits_{j=1}^{t} { d_i (x_{i_j} x_{i_{j+1}} \cdots x_{i_t} x_{i_1} \cdots x_{i_{j-1}}})$.

Question: Is there an easy (or even already existing) way to obtain the result of applying $\delta_i$ to a non-commutative polynomial using Sage?