@public
def field_isomorphism(a, b, **args):
 (a, b) = (sympify(a), sympify(b))
 if (not a.is_AlgebraicNumber):
  a = AlgebraicNumber(a)
 if (not b.is_AlgebraicNumber):
  b = AlgebraicNumber(b)
 if (a == b):
  return a.coeffs()
 n = a.minpoly.degree()
 m = b.minpoly.degree()
 if (n == 1):
  return [a.root]
 if ((m % n) != 0):
  return None
 if args.get('fast', True):
  try:
   result = field_isomorphism_pslq(a, b)
   if (result is not None):
    return result
  except NotImplementedError:
   pass
 return field_isomorphism_factor(a, b)

@ public def field_isomorphism ( a , b , ** args ) : ( a , b ) = ( sympify ( a ) , sympify ( b ) ) if ( not a . is_AlgebraicNumber ) : a = AlgebraicNumber ( a ) if ( not b . is_AlgebraicNumber ) : b = AlgebraicNumber ( b ) if ( a == b ) : return a . coeffs ( ) n = a . minpoly . degree ( ) m = b . minpoly . degree ( ) if ( n == 1 ) : return [ a . root ] if ( ( m % n ) != 0 ) : return None if args . get ( 'fast' , True ) : try : result = field_isomorphism_pslq ( a , b ) if ( result is not None ) : return result except NotImplementedError : pass return field_isomorphism_factor ( a , b )
construct an isomorphism between two number fields .