def _minpoly_exp(ex, x):
    'Returns the minimal polynomial of ``exp(ex)``.'
    (c, a) = ex.exp.as_coeff_Mul()
    q = sympify(c.denominator)
    if (a == (I * pi)):
        if (c.numerator in (1, (- 1))):
            if (q == 3):
                return (((x ** 2) - x) + 1)
            if (q == 4):
                return ((x ** 4) + 1)
            if (q == 6):
                return (((x ** 4) - (x ** 2)) + 1)
            if (q == 8):
                return ((x ** 8) + 1)
            if (q == 9):
                return (((x ** 6) - (x ** 3)) + 1)
            if (q == 10):
                return (((((x ** 8) - (x ** 6)) + (x ** 4)) - (x ** 2)) + 1)
            if q.is_prime:
                s = 0
                for i in range(q):
                    s += ((- x) ** i)
                return s
        factors = [cyclotomic_poly(i, x) for i in divisors((2 * q))]
        return _choose_factor(factors, x, ex)
    raise NotAlgebraic(f"{ex} doesn't seem to be an algebraic element")
Returns the minimal polynomial of ``exp(ex)``.
def _minpoly_exp(ex, x):
    
    (c, a) = ex.exp.as_coeff_Mul()
    q = sympify(c.denominator)
    if (a == (I * pi)):
        if (c.numerator in (1, (- 1))):
            if (q == 3):
                return (((x ** 2) - x) + 1)
            if (q == 4):
                return ((x ** 4) + 1)
            if (q == 6):
                return (((x ** 4) - (x ** 2)) + 1)
            if (q == 8):
                return ((x ** 8) + 1)
            if (q == 9):
                return (((x ** 6) - (x ** 3)) + 1)
            if (q == 10):
                return (((((x ** 8) - (x ** 6)) + (x ** 4)) - (x ** 2)) + 1)
            if q.is_prime:
                s = 0
                for i in range(q):
                    s += ((- x) ** i)
                return s
        factors = [cyclotomic_poly(i, x) for i in divisors((2 * q))]
        return _choose_factor(factors, x, ex)
    raise NotAlgebraic(f"{ex} doesn't seem to be an algebraic element")