code: def incomplete_gamma(x, s):
      r"""
      This function computes the incomplete lower gamma function
      using the series expansion:
  
      .. math::
  
         \gamma(x, s) = x^s \Gamma(s)e^{-x}\sum^\infty_{k=0}
                      \frac{x^k}{\Gamma(s + k + 1)}
  
      This series will converge strongly because the Gamma
      function grows factorially.
  
      Because the Gamma function does grow so quickly, we can
      run into numerical stability issues. To solve this we carry
      out as much math as possible in the log domain to reduce
      numerical error. This function matches the results from
      scipy to numerical precision.
      """
      if x < 0:
          return 1
      if x > 1e3:
          return math.gamma(s)
      log_gamma_s = math.lgamma(s)
      log_x = log(x)
      value = 0
      for k in range(100):
          log_num = (k + s) * log_x + (-x) + log_gamma_s
          log_denom = math.lgamma(k + s + 1)
          value += math.exp(log_num - log_denom)
      return value
  
imports: import math
  import sys
label_desc: Use image node_id 2 for calling a global function with example usage: incomplete_gamma(x, s) and returns: value, int, math