code: def evaluate_recurrence_coefficients(
          distribution,
          k_data,
          parameters=None,
          cache=None,
  ):
      
      assert len(k_data) == len(distribution), (
          "distribution %s is not of length %d" % (distribution, len(k_data)))
      assert len(k_data.shape) == 1
  
      def cache_key(distribution):
          return (tuple(k_data), distribution)
  
      if cache is None:
          cache = {}
      else:
          if cache_key(distribution) in cache:
              return cache[cache_key(distribution)]
  
      try:
          parameters = load_parameters(
              distribution, "_ttr", parameters, cache, cache_key)
          coeff1, coeff2 = distribution._ttr(k_data, **parameters)
  
      except NotImplementedError:
          from ... import quad
          _, _, coeff1, coeff2 = quad.stieltjes._stieltjes_approx(
              distribution, order=numpy.max(k_data), accuracy=100, normed=False)
          range_ = numpy.arange(len(distribution), dtype=int)
          coeff1 = coeff1[range_, k_data]
          coeff2 = coeff2[range_, k_data]
  
      out = numpy.zeros((2,) + k_data.shape)
      out.T[:, 0] = numpy.asarray(coeff1).T
      out.T[:, 1] = numpy.asarray(coeff2).T
      if len(distribution) == 1:
          out = out[:, 0]
  
      return out
docs: Evaluate three terms recurrence coefficients (TTR).
  
      Args:
          distribution (Dist):
              Distribution to evaluate.
          x_data (numpy.ndarray):
              Locations for where evaluate recurrence coefficients for.
          parameters (:py:data:typing.Any):
              Collection of parameters to override the default ones in the
              distribution.
          cache (:py:data:typing.Any):
              A collection of previous calculations in case the same distribution
              turns up on more than one occasion.
  
      Returns:
          The recurrence coefficients ``A`` and ``B`` of ``distribution`` at
          location ``x_data`` using parameters ``parameters``.