class_docstr: The Recurrence Operators are defined by a list of polynomials
  in the base ring and the parent ring of the Operator.
  
  Explanation
  ===========
  
  Takes a list of polynomials for each power of Sn and the
  parent ring which must be an instance of RecurrenceOperatorAlgebra.
  
  A Recurrence Operator can be created easily using
  the operator `Sn`. See examples below.
  
  Examples
  ========
  
  >>> from sympy.holonomic.recurrence import RecurrenceOperator, RecurrenceOperators
  >>> from sympy import ZZ
  >>> from sympy import symbols
  >>> n = symbols('n', integer=True)
  >>> R, Sn = RecurrenceOperators(ZZ.old_poly_ring(n),'Sn')
  
  >>> RecurrenceOperator([0, 1, n**2], R)
  (1)Sn + (n**2)Sn**2
  
  >>> Sn*n
  (n + 1)Sn
  
  >>> n*Sn*n + 1 - Sn**2*n
  (1) + (n**2 + n)Sn + (-n - 2)Sn**2
  
  See Also
  ========
  
  DifferentialOperatorAlgebra
class_docstr_tok: ["The","Recurrence","Operators","are","defined","by","a","list","of","polynomials","in","the","base","ring","and","the","parent","ring","of","the","Operator",".","Explanation","===========","Takes","a","list","of","polynomials","for","each","power","of","Sn","and","the","parent","ring","which","must","be","an","instance","of","RecurrenceOperatorAlgebra",".","A","Recurrence","Operator","can","be","created","easily","using","the","operator","`","Sn","`",".","See","examples","below",".","Examples","========",">",">",">","from","sympy.holonomic.recurrence","import","RecurrenceOperator",",","RecurrenceOperators",">",">",">","from","sympy","import","ZZ",">",">",">","from","sympy","import","symbols",">",">",">","n","=","symbols","(","'n","'",",","integer=True",")",">",">",">","R",",","Sn","=","RecurrenceOperators","(","ZZ.old_poly_ring","(","n",")",",","'Sn","'",")",">",">",">","RecurrenceOperator","(","[","0",",","1",",","n","*","*","2","]",",","R",")","(","1",")","Sn","+","(","n","*","*","2",")","Sn","*","*","2",">",">",">","Sn","*","n","(","n","+","1",")","Sn",">",">",">","n","*","Sn","*","n","+","1","-","Sn","*","*","2","*","n","(","1",")","+","(","n","*","*","2","+","n",")","Sn","+","(","-n","-","2",")","Sn","*","*","2","See","Also","========","DifferentialOperatorAlgebra"]
code: def __pow__(self, n):
      if n == 1:
          return self
      if n == 0:
          return RecurrenceOperator([self.parent.base.one], self.parent)
      # if self is `Sn`
      if self.listofpoly == self.parent.shift_operator.listofpoly:
          sol = []
          for i in range(0, n):
              sol.append(self.parent.base.zero)
          sol.append(self.parent.base.one)
  
          return RecurrenceOperator(sol, self.parent)
  
      else:
          if n % 2 == 1:
              powreduce = self ** (n - 1)
              return powreduce * self
          elif n % 2 == 0:
              powreduce = self ** (n / 2)
              return powreduce * powreduce
  
imports: from sympy.core.singleton import S
  from sympy.core.symbol import Symbol, symbols
  from sympy.printing import sstr
  from sympy.core.sympify import sympify
label_desc: Use image node_id 7 for calling the RecurrenceOperator obj's underlying member method code with example usage: obj.__pow__(n) and returns: self, RecurrenceOperator, RecurrenceOperator, unknown, unknown