For example, I have to write down the differential operator below as a polynomial in $\partial$ $$(\partial-f_n(x))(\partial-f_{n-1}(x))\cdots(\partial-f_1(x))$$where the product the the composition. Specifically, $$y_1 = x - \frac{m}{m+1},y_2=1,T_1=x^m(x-1),T_2=x^n$$ $$(\partial - D[y_1, x]/y_1)(\partial - D[T_1y_2/y_1, x]/(T_1y_2/y_1))(\partial - D[T_1T_2y_1/y_2, x]/(T_1T_2y_2/y_2)) (\partial - D[T_1^2T_2/y_1, x]/(T_1^2T_2/y_1))$$ Here $D[f,x]$ means $f'$.

I need the coefficients in $\partial$. And this is the simplest case that I will consider.

  • $\begingroup$ Can you give a specific example of what $f_i(x)$ might be, and of what you expect to do with this? $\endgroup$
    – bill s
    Dec 3, 2014 at 4:04
  • $\begingroup$ @bill s $f_i$ are some rational functions in $x$, I need the coefficients in $\partial$. Thanks $\endgroup$
    – Nirvanacs
    Dec 3, 2014 at 4:09
  • $\begingroup$ I don't know what you mean. Please give a specific example of the $f_i$ and what you expect/hope to see as an output. $\endgroup$
    – bill s
    Dec 3, 2014 at 4:14
  • $\begingroup$ @bill s, I have given a specific example. $\endgroup$
    – Nirvanacs
    Dec 3, 2014 at 4:26
  • $\begingroup$ Related to mathematica.stackexchange.com/questions/55182/… including my solution. $\endgroup$ Dec 3, 2014 at 13:01

1 Answer 1


I am assuming that $\partial$ in your question stands for the derivative with respect to x. Then you can directly use the method in my linked answer to solve this:

dx = Function[f, D[f, x]];
multiplyOp[scalar_, op_] := Function[{f1}, scalar op[f1]];
addOps[ops__] := Function[{f1}, Total@Map[#[f1] &, {ops}]];

CirclePlus[ops__] := addOps[ops];
CircleDot[scalar_, op_] := multiplyOp[scalar, op];
CircleTimes[ops__] := Composition[ops];

prod = (dx⊕f[2][x]⊙Identity)⊗(dx⊕f[1][x]⊙Identity);

CoefficientList[Simplify[prod[Exp[k x]]/Exp[k x]], k]

$\left\{f(1)'(x)+f(1)(x) f(2)(x),f(1)(x)+f(2)(x),1\right\}$

Here I constructed the operator prod for example with two factors of the general type in the question. Then I apply prod to a test function Exp[k x] which has the property that every derivative pulls down a factor of k. To get the coefficients of the powers or the original $\partial$ operator, one therefore needs only to collect the powers of k. This is done by CoefficientList (with the lowest power first and the highest power last).


Not the answer you're looking for? Browse other questions tagged or ask your own question.