code: def log_to_atan(f, g):
      """
      Convert complex logarithms to real arctangents.
  
      Explanation
      ===========
  
      Given a real field K and polynomials f and g in K[x], with g != 0,
      returns a sum h of arctangents of polynomials in K[x], such that:
  
                     dh   d         f + I g
                     -- = -- I log( ------- )
                     dx   dx        f - I g
  
      Examples
      ========
  
          >>> from sympy.integrals.rationaltools import log_to_atan
          >>> from sympy.abc import x
          >>> from sympy import Poly, sqrt, S
          >>> log_to_atan(Poly(x, x, domain='ZZ'), Poly(1, x, domain='ZZ'))
          2*atan(x)
          >>> log_to_atan(Poly(x + S(1)/2, x, domain='QQ'),
          ... Poly(sqrt(3)/2, x, domain='EX'))
          2*atan(2*sqrt(3)*x/3 + sqrt(3)/3)
  
      See Also
      ========
  
      log_to_real
      """
      if f.degree() < g.degree():
          f, g = -g, f
  
      f = f.to_field()
      g = g.to_field()
  
      p, q = f.div(g)
  
      if q.is_zero:
          return 2 * atan(p.as_expr())
      else:
          s, t, h = g.gcdex(-f)
          u = (f * s + g * t).quo(h)
          A = 2 * atan(u.as_expr())
  
          return A + log_to_atan(s, t)
  
file_path: sympy/sympy/integrals/rationaltools.py
imports: from sympy.core.function import Lambda
  from sympy.core.numbers import I
  from sympy.core.singleton import S
  from sympy.core.symbol import Dummy, Symbol, symbols
  from sympy.functions.elementary.exponential import log
  from sympy.functions.elementary.trigonometric import atan
  from sympy.polys.polyroots import roots
  from sympy.polys.polytools import cancel
  from sympy.polys.rootoftools import RootSum
  from sympy.polys import Poly, resultant, ZZ
label_desc: Use image node_id 4 for calling a global function with example usage: log_to_atan(f, g) and returns: unknown, unknown