code: def _evaluate_temme_coeffs(v):
      """Numerically stable computation of difference of gammas."""
      # This function computes the following quantities:
      # coeff1 = (1 / Gamma(1 - v) - 1 / Gamma(1 + v)) / 2v
      # coeff2 = (1 / Gamma(1 - v) + 1 / Gamma(1 + v)) / 2
      # gamma1mv = 1 / Gamma(1 - v)
      # gamma1pv = 1 / Gamma(1 + v)
      # Naive computation of the above two coefficients leads to
      # catastrophic cancellations. The below function computes
      # Chebyshev expansions to `coeff1` and `coeff2`.
  
      # Stable evaluation of the coefficients for the Temme power series.
      # We refer to [1] for the numerical evaluation
      # [1] Numerical Recipes in C. The Art of Scientific Computing,
      #   2nd Edition, 1992
  
      # These are Chebyshev expansion coefficients defined in 6.7.18 in [1].
      coeff1_coeffs = [
          -1.142022680371168e0,
          6.5165112670737e-3,
          3.087090173086e-4,
          -3.4706269649e-6,
          6.9437664e-9,
          3.67795e-11,
          -1.356e-13,
      ]
      coeff2_coeffs = [
          1.843740587300905e0,
          -7.68528408447867e-2,
          1.2719271366546e-3,
          -4.9717367042e-6,
          -3.31261198e-8,
          2.423096e-10,
          -1.702e-13,
          -1.49e-15,
      ]
      w = 8 * tf.math.square(v) - 1.0
  
      # Use Clenshaw's recurrence for evaluating the Chebyshev polynomials
      # associated to the coefficients.
      y = 2 * w
  
      prev = 0.0
      current = 0.0
      for i in reversed(range(1, len(coeff1_coeffs))):
          temp = current
          current = y * current - prev + coeff1_coeffs[i]
          prev = temp
      coeff1 = w * current - prev + 0.5 * coeff1_coeffs[0]
  
      prev = 0.0
      current = 0.0
      for i in reversed(range(1, len(coeff2_coeffs))):
          temp = current
          current = y * current - prev + coeff2_coeffs[i]
          prev = temp
      coeff2 = w * current - prev + 0.5 * coeff2_coeffs[0]
      gamma1pv = coeff2 - v * coeff1
      gamma1mv = coeff2 + v * coeff1
      return coeff1, coeff2, gamma1pv, gamma1mv
  
imports: import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import custom_gradient
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.math import generic
label_desc: Use image node_id 11 for calling a global function with example usage: _evaluate_temme_coeffs(v) and returns: coeff1,  coeff2,  gamma1pv,  gamma1mv