lcapy.utils.factor_const

lcapy.utils.factor_const(expr, var)

Extract constant factor from expression and return tuple of constant and the rest of the expression.

For example a * r(var) returns a, r(var).

If have a polynomial expression, the leading coefficient is returned as the constant, for example: 2 * s + 4 returns 2, s + 2.