code: def field_isomorphism_factor(a, b):
      """Construct field isomorphism via factorization."""
      _, factors = factor_list(a.minpoly, extension=b)
      for f, _ in factors:
          if f.degree() == 1:
              # Any linear factor f(x) represents some conjugate of a in QQ(b).
              # We want to know whether this linear factor represents a itself.
              # Let f = x - c
              c = -f.rep.TC()
              # Write c as polynomial in b
              coeffs = c.to_sympy_list()
              d, terms = len(coeffs) - 1, []
              for i, coeff in enumerate(coeffs):
                  terms.append(coeff * b.root ** (d - i))
              r = Add(*terms)
              # Check whether we got the number a
              if a.minpoly.same_root(r, a):
                  return coeffs
  
      # If none of the linear factors represented a in QQ(b), then in fact a is
      # not an element of QQ(b).
      return None
  
imports: from sympy.core.add import Add
  from sympy.core.numbers import AlgebraicNumber
  from sympy.core.singleton import S
  from sympy.core.symbol import Dummy
  from sympy.core.sympify import sympify, _sympify
  from sympy.ntheory import sieve
  from sympy.polys.densetools import dup_eval
  from sympy.polys.domains import QQ
  from sympy.polys.numberfields.minpoly import _choose_factor, minimal_polynomial
  from sympy.polys.polyerrors import IsomorphismFailed
  from sympy.polys.polytools import Poly, PurePoly, factor_list
  from sympy.utilities import public
  from mpmath import MPContext
label_desc: Use image node_id 3 for calling a global function with example usage: field_isomorphism_factor(a, b) and returns: None, coeffs