pystencils.sympyextensions.math.remove_higher_order_terms

pystencils.sympyextensions.math.remove_higher_order_terms#

pystencils.sympyextensions.math.remove_higher_order_terms(expr, symbols, order=3)#

Removes all terms that contain more than ‘order’ factors of given ‘symbols’

Return type:

Expr

Parameters:

Example

>>> x, y = sp.symbols("x y")
>>> term = x**2 * y + y**2 * x + y**3 + x + y ** 2
>>> remove_higher_order_terms(term, order=2, symbols=[x, y])
x + y**2