docstr: Perform substitutions over non-dummy variables
  of an expression with limits.  Also, can be used
  to specify point-evaluation of an abstract antiderivative.
  
  Examples
  ========
  
  >>> from sympy import Sum, oo
  >>> from sympy.abc import s, n
  >>> Sum(1/n**s, (n, 1, oo)).subs(s, 2)
  Sum(n**(-2), (n, 1, oo))
  
  >>> from sympy import Integral
  >>> from sympy.abc import x, a
  >>> Integral(a*x**2, x).subs(x, 4)
  Integral(a*x**2, (x, 4))
  
  See Also
  ========
  
  variables : Lists the integration variables
  transform : Perform mapping on the dummy variable for integrals
  change_index : Perform mapping on the sum and product dummy variables
docstr_tok: ["Perform","substitutions","over","non-dummy","variables","of","an","expression","with","limits",".","Also",",","can","be","used","to","specify","point-evaluation","of","an","abstract","antiderivative",".","Examples","========",">",">",">","from","sympy","import","Sum",",","oo",">",">",">","from","sympy.abc","import","s",",","n",">",">",">","Sum","(","1\/n","*","*","s",",","(","n",",","1",",","oo",")",")",".subs","(","s",",","2",")","Sum","(","n","*","*","(","-2",")",",","(","n",",","1",",","oo",")",")",">",">",">","from","sympy","import","Integral",">",">",">","from","sympy.abc","import","x",",","a",">",">",">","Integral","(","a","*","x","*","*","2",",","x",")",".subs","(","x",",","4",")","Integral","(","a","*","x","*","*","2",",","(","x",",","4",")",")","See","Also","========","variables",":","Lists","the","integration","variables","transform",":","Perform","mapping","on","the","dummy","variable","for","integrals","change_index",":","Perform","mapping","on","the","sum","and","product","dummy","variables"]
code: def _eval_subs(self, old, new):
      """
      Perform substitutions over non-dummy variables
      of an expression with limits.  Also, can be used
      to specify point-evaluation of an abstract antiderivative.
  
      Examples
      ========
  
      >>> from sympy import Sum, oo
      >>> from sympy.abc import s, n
      >>> Sum(1/n**s, (n, 1, oo)).subs(s, 2)
      Sum(n**(-2), (n, 1, oo))
  
      >>> from sympy import Integral
      >>> from sympy.abc import x, a
      >>> Integral(a*x**2, x).subs(x, 4)
      Integral(a*x**2, (x, 4))
  
      See Also
      ========
  
      variables : Lists the integration variables
      transform : Perform mapping on the dummy variable for integrals
      change_index : Perform mapping on the sum and product dummy variables
  
      """
      func, limits = self.function, list(self.limits)
  
      # If one of the expressions we are replacing is used as a func index
      # one of two things happens.
      #   - the old variable first appears as a free variable
      #     so we perform all free substitutions before it becomes
      #     a func index.
      #   - the old variable first appears as a func index, in
      #     which case we ignore.  See change_index.
  
      # Reorder limits to match standard mathematical practice for scoping
      limits.reverse()
  
      if not isinstance(old, Symbol) or old.free_symbols.intersection(
          self.free_symbols
      ):
          sub_into_func = True
          for i, xab in enumerate(limits):
              if 1 == len(xab) and old == xab[0]:
                  if new._diff_wrt:
                      xab = (new,)
                  else:
                      xab = (old, old)
              limits[i] = Tuple(
                  xab[0], *[l._subs(old, new) for l in xab[1:]]
              )
              if (
                  len(
                      xab[0].free_symbols.intersection(old.free_symbols)
                  )
                  != 0
              ):
                  sub_into_func = False
                  break
          if isinstance(old, (AppliedUndef, UndefinedFunction)):
              sy2 = set(self.variables).intersection(
                  set(new.atoms(Symbol))
              )
              sy1 = set(self.variables).intersection(set(old.args))
              if not sy2.issubset(sy1):
                  raise ValueError(
                      "substitution cannot create dummy dependencies"
                  )
              sub_into_func = True
          if sub_into_func:
              func = func.subs(old, new)
      else:
          # old is a Symbol and a dummy variable of some limit
          for i, xab in enumerate(limits):
              if len(xab) == 3:
                  limits[i] = Tuple(
                      xab[0], *[l._subs(old, new) for l in xab[1:]]
                  )
                  if old == xab[0]:
                      break
      # simplify redundant limits (x, x)  to (x, )
      for i, xab in enumerate(limits):
          if len(xab) == 2 and (xab[0] - xab[1]).is_zero:
              limits[i] = Tuple(
                  xab[0],
              )
  
      # Reorder limits back to representation-form
      limits.reverse()
  
      return self.func(func, *limits)
  
imports: from sympy.core.add import Add
  from sympy.core.containers import Tuple
  from sympy.core.expr import Expr
  from sympy.core.function import AppliedUndef, UndefinedFunction
  from sympy.core.mul import Mul
  from sympy.core.relational import Equality, Relational
  from sympy.core.singleton import S
  from sympy.core.symbol import Symbol, Dummy
  from sympy.core.sympify import sympify
  from sympy.functions.elementary.piecewise import piecewise_fold, Piecewise
  from sympy.logic.boolalg import BooleanFunction
  from sympy.matrices.matrixbase import MatrixBase
  from sympy.sets.sets import Interval, Set
  from sympy.sets.fancysets import Range
  from sympy.tensor.indexed import Idx
  from sympy.utilities import flatten
  from sympy.utilities.iterables import sift, is_sequence
  from sympy.utilities.exceptions import sympy_deprecation_warning
label_desc: Use image node_id 10 for calling the ExprWithLimits obj's underlying member method code with example usage: obj._eval_subs(old, new) and returns: self