Ask Your Question

Revision history [back]

How to extract coefficient terms from a differential equation, as for polynomial?

Hello all. As title, I want to extract from a differential equation the term coefficients with respect to a variable. For example:

var('x, u')
y = function('y', x)
DE = y.diff(x)*u^2 + 2*u + x

from DE I want to create a new symbolic expression with the coefficient of u^2, in this case y.diff(x). Must I convert DE to a polynomial ring? And how can I do it?