Beispiel #1
0
def expand(expression, variable=None):
    expression = expand_(expression)
    if isinstance(expression, Basic) and expression.is_rational_function():
        if variable is None:
            variable = extract_var(expression)
        return apart(expression, variable)
    return expression
Beispiel #2
0
def expand(expression, variable = None):
    expression = expand_(expression)
    if isinstance(expression, Basic) and expression.is_rational_function():
        if variable is None:
           variable = extract_var(expression)
        return apart(expression, variable)
    return expression
Beispiel #3
0
def expand(expression, variable = None):
    expression = expand_(expression)
    if isinstance(expression, Basic) and expression.is_rational_function():
        # Éviter d'appeler `apart()` pour rien, d'autant que FloatFrac() n'est
        # pas compatible avec apart() (sympy v0.7.2).
        num, den = expression.as_numer_denom()
        if den.free_symbols:
            if variable is None:
               variable = extract_var(expression)
            return apart(expression, variable)
    return expression