class_docstr: References
  ==========
  
  .. [1] Holt, D., Eick, B., O'Brien, E.
         "Handbook of Computational Group Theory"
         Section 8.1.3
class_docstr_tok: ["References","==========","..","[","1","]","Holt",",","D.",",","Eick",",","B.",",","O'Brien",",","E.","``","Handbook","of","Computational","Group","Theory","''","Section","8.1.3"]
docstr: Returns the start and ending index of a given
  subword in a word.
  
  Parameters
  ==========
  
  word : FreeGroupElement
      word defined on free group elements for a
      polycyclic group.
  w : FreeGroupElement
      subword of a given word, whose starting and
      ending index to be computed.
  
  Returns
  =======
  
  (i, j)
      A tuple containing starting and ending index of ``w``
      in the given word.
  
  Examples
  ========
  
  >>> from sympy.combinatorics.named_groups import SymmetricGroup
  >>> from sympy.combinatorics import free_group
  >>> G = SymmetricGroup(4)
  >>> PcGroup = G.polycyclic_group()
  >>> collector = PcGroup.collector
  >>> F, x1, x2 = free_group("x1, x2")
  >>> word = x2**2*x1**7
  >>> w = x2**2*x1
  >>> collector.subword_index(word, w)
  (0, 3)
  >>> w = x1**7
  >>> collector.subword_index(word, w)
  (2, 9)
docstr_tok: ["Returns","the","start","and","ending","index","of","a","given","subword","in","a","word",".","Parameters","==========","word",":","FreeGroupElement","word","defined","on","free","group","elements","for","a","polycyclic","group",".","w",":","FreeGroupElement","subword","of","a","given","word",",","whose","starting","and","ending","index","to","be","computed",".","Returns","=======","(","i",",","j",")","A","tuple","containing","starting","and","ending","index","of","``","w","``","in","the","given","word",".","Examples","========",">",">",">","from","sympy.combinatorics.named_groups","import","SymmetricGroup",">",">",">","from","sympy.combinatorics","import","free_group",">",">",">","G","=","SymmetricGroup","(","4",")",">",">",">","PcGroup","=","G.polycyclic_group","(",")",">",">",">","collector","=","PcGroup.collector",">",">",">","F",",","x1",",","x2","=","free_group","(","``","x1",",","x2","''",")",">",">",">","word","=","x2","*","*","2","*","x1","*","*","7",">",">",">","w","=","x2","*","*","2","*","x1",">",">",">","collector.subword_index","(","word",",","w",")","(","0",",","3",")",">",">",">","w","=","x1","*","*","7",">",">",">","collector.subword_index","(","word",",","w",")","(","2",",","9",")"]
code: def subword_index(self, word, w):
      """
      Returns the start and ending index of a given
      subword in a word.
  
      Parameters
      ==========
  
      word : FreeGroupElement
          word defined on free group elements for a
          polycyclic group.
      w : FreeGroupElement
          subword of a given word, whose starting and
          ending index to be computed.
  
      Returns
      =======
  
      (i, j)
          A tuple containing starting and ending index of ``w``
          in the given word.
  
      Examples
      ========
  
      >>> from sympy.combinatorics.named_groups import SymmetricGroup
      >>> from sympy.combinatorics import free_group
      >>> G = SymmetricGroup(4)
      >>> PcGroup = G.polycyclic_group()
      >>> collector = PcGroup.collector
      >>> F, x1, x2 = free_group("x1, x2")
      >>> word = x2**2*x1**7
      >>> w = x2**2*x1
      >>> collector.subword_index(word, w)
      (0, 3)
      >>> w = x1**7
      >>> collector.subword_index(word, w)
      (2, 9)
  
      """
      low = -1
      high = -1
      for i in range(len(word) - len(w) + 1):
          if word.subword(i, i + len(w)) == w:
              low = i
              high = i + len(w)
              break
      if low == high == -1:
          return -1, -1
      return low, high
  
imports: from sympy.ntheory.primetest import isprime
  from sympy.combinatorics.perm_groups import PermutationGroup
  from sympy.printing.defaults import DefaultPrinting
  from sympy.combinatorics.free_groups import free_group
label_desc: Use image node_id 4 for calling the Collector obj's underlying member method code with example usage: obj.subword_index(word, w) and returns: low,  high, unknown,  unknown