class_docstr: Represents a field domain. 
class_docstr_tok: ["Represents","a","field","domain","."]
docstr: Returns GCD of ``a`` and ``b``.
  
  This definition of GCD over fields allows to clear denominators
  in `primitive()`.
  
  Examples
  ========
  
  >>> from sympy.polys.domains import QQ
  >>> from sympy import S, gcd, primitive
  >>> from sympy.abc import x
  
  >>> QQ.gcd(QQ(2, 3), QQ(4, 9))
  2/9
  >>> gcd(S(2)/3, S(4)/9)
  2/9
  >>> primitive(2*x/3 + S(4)/9)
  (2/9, 3*x + 2)
docstr_tok: ["Returns","GCD","of","``","a","``","and","``","b","``",".","This","definition","of","GCD","over","fields","allows","to","clear","denominators","in","`","primitive","(",")","`",".","Examples","========",">",">",">","from","sympy.polys.domains","import","QQ",">",">",">","from","sympy","import","S",",","gcd",",","primitive",">",">",">","from","sympy.abc","import","x",">",">",">","QQ.gcd","(","QQ","(","2",",","3",")",",","QQ","(","4",",","9",")",")","2\/9",">",">",">","gcd","(","S","(","2",")","\/3",",","S","(","4",")","\/9",")","2\/9",">",">",">","primitive","(","2","*","x\/3","+","S","(","4",")","\/9",")","(","2\/9",",","3","*","x","+","2",")"]
code: def gcd(self, a, b):
      """
      Returns GCD of ``a`` and ``b``.
  
      This definition of GCD over fields allows to clear denominators
      in `primitive()`.
  
      Examples
      ========
  
      >>> from sympy.polys.domains import QQ
      >>> from sympy import S, gcd, primitive
      >>> from sympy.abc import x
  
      >>> QQ.gcd(QQ(2, 3), QQ(4, 9))
      2/9
      >>> gcd(S(2)/3, S(4)/9)
      2/9
      >>> primitive(2*x/3 + S(4)/9)
      (2/9, 3*x + 2)
  
      """
      try:
          ring = self.get_ring()
      except DomainError:
          return self.one
  
      p = ring.gcd(self.numer(a), self.numer(b))
      q = ring.lcm(self.denom(a), self.denom(b))
  
      return self.convert(p, ring) / q
  
file_path: sympy/sympy/polys/domains/field.py
imports: from sympy.polys.domains.ring import Ring
  from sympy.polys.polyerrors import NotReversible, DomainError
  from sympy.utilities import public
label_desc: Use image node_id 7 for calling the Field obj's underlying member method code with example usage: obj.gcd(a, b) and returns: unknown, self