# Coefficient Array from total derivative of expression

I have an expression $$\dot{r}\dot{\eta}+r^{2}\dot{\theta}\dot{\xi}=0$$ where $$\eta$$ and $$\xi$$ are both functions of $$r,\theta$$. In MM I wrote this as

de = Dt[r, t] Dt[eta[r, th], t] + r^2 Dt[th, t] Dt[xi[r, th], t]


What I wish to do now is solve this equation by separating it into a set of PDEs for each power of $$\dot{r}, \dot{\theta}$$ and then integrating each to find the functions $$\xi,\eta$$. What I need is an equivalent of CoefficientArrays for each power of the co-ordinate derivatives.

For instance, the $$\dot{r}\dot{\theta}$$ term would be $$\eta_{\theta} +r^2\xi_r$$ where the subscript denotes partial differentiation. Is there a way to do this? I tried the linked answer but couldn't get it to work for my purposes. Thank you!

EDIT: The answer provided by @kglr works perfectly! Simply Normal@Rest@CoefficientArrays[de, {Dt[r, t] , Dt[th, t]}] which for some reason I couldn't get to work.

As an extension to this problem, what happens if xi and eta are also functions of Dt[r,t] and Dt[th,t]? Now coefficient array returns the error "not a polynomial" because it is trying to pattern match inside the functions when I don't want it to. Any ideas?

P.S the Dt[r,{t,2}] and Dt[th,{t,2}] terms that result can be ignored because in practise they are replaced by their respective equations of motion which are functions of Dt[r,t] and Dt[th,t]. For all intents and purposes we can simply use a replace rule to set Dt[r,{t,2}] and Dt[th,{t,2}] equal to 0.

• Normal@Rest@CoefficientArrays[de, {Dt[r, t] , Dt[th, t]}]? – kglr Aug 7 '19 at 17:42
• .. or Normal@Rest@ CoefficientArrays[de, {Dt[r, t] , Dt[th, t], Dt[eta, t], Dt[xi, t]}]? – kglr Aug 7 '19 at 17:43
• @kglr That seems to work! I have no idea why what I was doing before didn't... Anyway I am going to extend this question a bit: What happens if xi and eta are also functions of Dt[r,t] and Dt[th,t]? Now coefficient array returns the error "not a polynomial" because it is trying to pattern match inside the functions when I don't want it to. Any ideas? I will edit my question with your answer and this followup. – Takoda Aug 8 '19 at 8:31

The answer is to use CoefficientList.
CoefficientList[de, {Dt[r, t], Dt[th, t]}] //ColumnForm

gives the associated PDEs in each power of your co-ordinate velocities. Then all you need to do is Flatten and DeleteCases of 0 and you get a system of PDEs that you can solve.
DeleteCases[CoefficientList[de, {Dt[r, t], Dt[th, t]}], 0, Infinity] // Flatten