

def _nthroot_solve(p, n, prec):
    '\n     helper function for ``nthroot``\n     It denests ``p**Rational(1, n)`` using its minimal polynomial\n    '
    from sympy.polys.numberfields import _minimal_polynomial_sq
    from sympy.solvers import solve
    while ((n % 2) == 0):
        p = sqrtdenest(sqrt(p))
        n = (n // 2)
    if (n == 1):
        return p
    pn = (p ** Rational(1, n))
    x = Symbol('x')
    f = _minimal_polynomial_sq(p, x, x)
    if (f is None):
        return None
    sols = solve(f, x)
    for sol in sols:
        if (abs((sol - pn)).n() < (1.0 / (10 ** prec))):
            sol = sqrtdenest(sol)
            if (_mexpand((sol ** n)) == p):
                return sol

dataset/ETHPy150Open sympy/sympy/sympy/simplify/simplify.py _nthroot_solve/VarMisuse@103/170 `n`->`x`