code: def is_log_deriv_k_t_radical_in_field(
      fa, fd, DE, case="auto", z=None
  ):
      """
      Checks if f can be written as the logarithmic derivative of a k(t)-radical.
  
      Explanation
      ===========
  
      It differs from is_log_deriv_k_t_radical(fa, fd, DE, Df=False)
      for any given fa, fd, DE in that it finds the solution in the
      given field not in some (possibly unspecified extension) and
      "in_field" with the function name is used to indicate that.
  
      f in k(t) can be written as the logarithmic derivative of a k(t) radical if
      there exist n in ZZ and u in k(t) with n, u != 0 such that n*f == Du/u.
      Either returns (n, u) or None, which means that f cannot be written as the
      logarithmic derivative of a k(t)-radical.
  
      case is one of {'primitive', 'exp', 'tan', 'auto'} for the primitive,
      hyperexponential, and hypertangent cases, respectively.  If case is 'auto',
      it will attempt to determine the type of the derivation automatically.
  
      See also
      ========
      is_log_deriv_k_t_radical, is_deriv_k
  
      """
      fa, fd = fa.cancel(fd, include=True)
  
      # f must be simple
      n, s = splitfactor(fd, DE)
      if not s.is_one:
          pass
  
      z = z or Dummy("z")
      H, b = residue_reduce(fa, fd, DE, z=z)
      if not b:
          # I will have to verify, but I believe that the answer should be
          # None in this case. This should never happen for the
          # functions given when solving the parametric logarithmic
          # derivative problem when integration elementary functions (see
          # Bronstein's book, page 255), so most likely this indicates a bug.
          return None
  
      roots = [(i, i.real_roots()) for i, _ in H]
      if not all(
          len(j) == i.degree() and all(k.is_Rational for k in j)
          for i, j in roots
      ):
          # If f is the logarithmic derivative of a k(t)-radical, then all the
          # roots of the resultant must be rational numbers.
          return None
  
      # [(a, i), ...], where i*log(a) is a term in the log-part of the integral
      # of f
      respolys, residues = list(zip(*roots)) or [[], []]
      # Note: this might be empty, but everything below should work find in that
      # case (it should be the same as if it were [[1, 1]])
      residueterms = [
          (H[j][1].subs(z, i), i)
          for j in range(len(H))
          for i in residues[j]
      ]
  
      # TODO: finish writing this and write tests
  
      p = cancel(
          fa.as_expr() / fd.as_expr()
          - residue_reduce_derivation(H, DE, z)
      )
  
      p = p.as_poly(DE.t)
      if p is None:
          # f - Dg will be in k[t] if f is the logarithmic derivative of a k(t)-radical
          return None
  
      if p.degree(DE.t) >= max(1, DE.d.degree(DE.t)):
          return None
  
      if case == "auto":
          case = DE.case
  
      if case == "exp":
          wa, wd = derivation(DE.t, DE).cancel(
              Poly(DE.t, DE.t), include=True
          )
          with DecrementLevel(DE):
              pa, pd = frac_in(p, DE.t, cancel=True)
              wa, wd = frac_in((wa, wd), DE.t)
              A = parametric_log_deriv(pa, pd, wa, wd, DE)
          if A is None:
              return None
          n, e, u = A
          u *= DE.t**e
  
      elif case == "primitive":
          with DecrementLevel(DE):
              pa, pd = frac_in(p, DE.t)
              A = is_log_deriv_k_t_radical_in_field(
                  pa, pd, DE, case="auto"
              )
          if A is None:
              return None
          n, u = A
  
      elif case == "base":
          # TODO: we can use more efficient residue reduction from ratint()
          if not fd.is_sqf or fa.degree() >= fd.degree():
              # f is the logarithmic derivative in the base case if and only if
              # f = fa/fd, fd is square-free, deg(fa) < deg(fd), and
              # gcd(fa, fd) == 1.  The last condition is handled by cancel() above.
              return None
          # Note: if residueterms = [], returns (1, 1)
          # f had better be 0 in that case.
          n = S.One * reduce(
              ilcm, [i.as_numer_denom()[1] for _, i in residueterms], 1
          )
          u = Mul(*[Pow(i, j * n) for i, j in residueterms])
          return (n, u)
  
      elif case == "tan":
          raise NotImplementedError(
              "The hypertangent case is "
              "not yet implemented for is_log_deriv_k_t_radical_in_field()"
          )
  
      elif case in ("other_linear", "other_nonlinear"):
          # XXX: If these are supported by the structure theorems, change to NotImplementedError.
          raise ValueError(
              "The %s case is not supported in this function." % case
          )
  
      else:
          raise ValueError(
              "case must be one of {'primitive', 'exp', 'tan', "
              "'base', 'auto'}, not %s" % case
          )
  
      common_denom = S.One * reduce(
          ilcm,
          [i.as_numer_denom()[1] for i in [j for _, j in residueterms]]
          + [n],
          1,
      )
      residueterms = [(i, j * common_denom) for i, j in residueterms]
      m = common_denom // n
      if common_denom != n * m:  # Verify exact division
          raise ValueError("Inexact division")
      u = cancel(u**m * Mul(*[Pow(i, j) for i, j in residueterms]))
  
      return (common_denom, u)
  
imports: import itertools
  from functools import reduce
  from sympy.core.intfunc import ilcm
  from sympy.core import Dummy, Add, Mul, Pow, S
  from sympy.integrals.rde import order_at, order_at_oo, weak_normalizer, bound_degree
  from sympy.integrals.risch import gcdex_diophantine, frac_in, derivation, residue_reduce, splitfactor, residue_reduce_derivation, DecrementLevel, recognize_log_derivative
  from sympy.polys import Poly, lcm, cancel, sqf_list
  from sympy.polys.polymatrix import PolyMatrix
  from sympy.solvers import solve
label_desc: Use image node_id 19 for calling a global function with example usage: is_log_deriv_k_t_radical_in_field(fa, fd, DE, case, z) and returns: common_denom,  u, None, None, None, None, None, None, n,  u, None