This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

ufl equivalent of sympy's as_coefficient()

+1 vote

Consider a simple expression:

expr = a*u*v*dx + b*w*z*dx

Is there a function in ufl which will return the coefficients of a terminal in expr? E.g:

expr.as_coefficient(a)
>>> u*v*dx

expr.as_coefficient(b)
>>> w*z*dx
asked Dec 18, 2016 by nate FEniCS Expert (17,050 points)
...