code: def terms(order, dim):
      
      return int(scipy.special.comb(order+dim, dim, 1))
docs: Count the number of polynomials in an expansion.
  
      Parameters
      ----------
      order : int
          The upper order for the expansion.
      dim : int
          The number of dimensions of the expansion.
  
      Returns
      -------
      N : int
          The number of terms in an expansion of upper order `M` and
          number of dimensions `dim`.