(rep, *gens)
return Add(*result)
Convert a multinomial form into an expression.
Convert a multinomial form into an expression.
Convert a multinomial form into an expression .
def expr_from_dict(rep, *gens):
    """Convert a multinomial form into an expression. """
    result = []

    for monom, coeff in rep.items():
        term = [coeff]
        for g, m in zip(gens, monom):
            if m:
                term.append(Pow(g, m))

        result.append(Mul(*term))

    return Add(*result)
def expr_from_dict ( rep , * gens ) : result = [ ] for monom , coeff in rep . items ( ) : term = [ coeff ] for g , m in zip ( gens , monom ) : if m : term . append ( Pow ( g , m ) ) result . append ( Mul ( * term ) ) return Add ( * result )