(obj, **args)
Construct a minimal domain for the list of coefficients.
Construct a minimal domain for the list of coefficients.
Construct a minimal domain for the list of coefficients .
def construct_domain(obj, **args):
    """Construct a minimal domain for the list of coefficients. """
    opt = build_options(args)

    if hasattr(obj, '__iter__'):
        if isinstance(obj, dict):
            if not obj:
                monoms, coeffs = [], []
            else:
                monoms, coeffs = list(zip(*list(obj.items())))
        else:
            coeffs = obj
    else:
        coeffs = [obj]

    coeffs = list(map(sympify, coeffs))
    result = _construct_simple(coeffs, opt)

    if result is not None:
        if result is not False:
            domain, coeffs = result
        else:
            domain, coeffs = _construct_expression(coeffs, opt)
    else:
        if opt.composite is False:
            result = None
        else:
            result = _construct_composite(coeffs, opt)

        if result is not None:
            domain, coeffs = result
        else:
            domain, coeffs = _construct_expression(coeffs, opt)

    if hasattr(obj, '__iter__'):
        if isinstance(obj, dict):
            return domain, dict(list(zip(monoms, coeffs)))
        else:
            return domain, coeffs
    else:
        return domain, coeffs[0]
def construct_domain ( obj , * * args ) : opt = build_options ( args ) if hasattr ( obj , '__iter__' ) : if isinstance ( obj , dict ) : if not obj : monoms , coeffs = [ ] , [ ] else : monoms , coeffs = list ( zip ( * list ( obj . items ( ) ) ) ) else : coeffs = obj else : coeffs = [ obj ] coeffs = list ( map ( sympify , coeffs ) ) result = _construct_simple ( coeffs , opt ) if result is not None : if result is not False : domain , coeffs = result else : domain , coeffs = _construct_expression ( coeffs , opt ) else : if opt . composite is False : result = None else : result = _construct_composite ( coeffs , opt ) if result is not None : domain , coeffs = result else : domain , coeffs = _construct_expression ( coeffs , opt ) if hasattr ( obj , '__iter__' ) : if isinstance ( obj , dict ) : return domain , dict ( list ( zip ( monoms , coeffs ) ) ) else : return domain , coeffs else : return domain , coeffs [ 0 ]