class_docstr: For each semisimple Lie group, we have a Weyl group.  It is a subgroup of
  the isometry group of the root system.  Specifically, it's the subgroup
  that is generated by reflections through the hyperplanes orthogonal to
  the roots.  Therefore, Weyl groups are reflection groups, and so a Weyl
  group is a finite Coxeter group.
docstr: This method takes input from the user in the form of products of the
  generating reflections, and returns the matrix corresponding to the
  element of the Weyl group.  Since each element of the Weyl group is
  a reflection of some type, there is a corresponding matrix representation.
  This method uses the standard representation for all the generating
  reflections.
  
  Examples
  ========
  
  >>> from sympy.liealgebras.weyl_group import WeylGroup
  >>> f = WeylGroup("F4")
  >>> f.matrix_form('r2*r3')
  Matrix([
  [1, 0, 0,  0],
  [0, 1, 0,  0],
  [0, 0, 0, -1],
  [0, 0, 1,  0]])
docstr_tok: ["This","method","takes","input","from","the","user","in","the","form","of","products","of","the","generating","reflections",",","and","returns","the","matrix","corresponding","to","the","element","of","the","Weyl","group",".","Since","each","element","of","the","Weyl","group","is","a","reflection","of","some","type",",","there","is","a","corresponding","matrix","representation",".","This","method","uses","the","standard","representation","for","all","the","generating","reflections",".","Examples","========",">",">",">","from","sympy.liealgebras.weyl_group","import","WeylGroup",">",">",">","f","=","WeylGroup","(","``","F4","''",")",">",">",">","f.matrix_form","(","'r2","*","r3","'",")","Matrix","(","[","[","1",",","0",",","0",",","0","]",",","[","0",",","1",",","0",",","0","]",",","[","0",",","0",",","0",",","-1","]",",","[","0",",","0",",","1",",","0","]","]",")"]
code: def matrix_form(self, weylelt):
      """
      This method takes input from the user in the form of products of the
      generating reflections, and returns the matrix corresponding to the
      element of the Weyl group.  Since each element of the Weyl group is
      a reflection of some type, there is a corresponding matrix representation.
      This method uses the standard representation for all the generating
      reflections.
  
      Examples
      ========
  
      >>> from sympy.liealgebras.weyl_group import WeylGroup
      >>> f = WeylGroup("F4")
      >>> f.matrix_form('r2*r3')
      Matrix([
      [1, 0, 0,  0],
      [0, 1, 0,  0],
      [0, 0, 0, -1],
      [0, 0, 1,  0]])
  
      """
      elts = list(weylelt)
      reflections = elts[1::3]
      n = self.cartan_type.rank()
      if self.cartan_type.series == "A":
          matrixform = eye(n + 1)
          for elt in reflections:
              a = int(elt)
              mat = eye(n + 1)
              mat[a - 1, a - 1] = 0
              mat[a - 1, a] = 1
              mat[a, a - 1] = 1
              mat[a, a] = 0
              matrixform *= mat
          return matrixform
  
      if self.cartan_type.series == "D":
          matrixform = eye(n)
          for elt in reflections:
              a = int(elt)
              mat = eye(n)
              if a < n:
                  mat[a - 1, a - 1] = 0
                  mat[a - 1, a] = 1
                  mat[a, a - 1] = 1
                  mat[a, a] = 0
                  matrixform *= mat
              else:
                  mat[n - 2, n - 1] = -1
                  mat[n - 2, n - 2] = 0
                  mat[n - 1, n - 2] = -1
                  mat[n - 1, n - 1] = 0
                  matrixform *= mat
          return matrixform
  
      if self.cartan_type.series == "G":
          matrixform = eye(3)
          for elt in reflections:
              a = int(elt)
              if a == 1:
                  gen1 = Matrix([[1, 0, 0], [0, 0, 1], [0, 1, 0]])
                  matrixform *= gen1
              else:
                  gen2 = Matrix(
                      [
                          [
                              Rational(2, 3),
                              Rational(2, 3),
                              Rational(-1, 3),
                          ],
                          [
                              Rational(2, 3),
                              Rational(-1, 3),
                              Rational(2, 3),
                          ],
                          [
                              Rational(-1, 3),
                              Rational(2, 3),
                              Rational(2, 3),
                          ],
                      ]
                  )
                  matrixform *= gen2
          return matrixform
  
      if self.cartan_type.series == "F":
          matrixform = eye(4)
          for elt in reflections:
              a = int(elt)
              if a == 1:
                  mat = Matrix(
                      [
                          [1, 0, 0, 0],
                          [0, 0, 1, 0],
                          [0, 1, 0, 0],
                          [0, 0, 0, 1],
                      ]
                  )
                  matrixform *= mat
              elif a == 2:
                  mat = Matrix(
                      [
                          [1, 0, 0, 0],
                          [0, 1, 0, 0],
                          [0, 0, 0, 1],
                          [0, 0, 1, 0],
                      ]
                  )
                  matrixform *= mat
              elif a == 3:
                  mat = Matrix(
                      [
                          [1, 0, 0, 0],
                          [0, 1, 0, 0],
                          [0, 0, 1, 0],
                          [0, 0, 0, -1],
                      ]
                  )
                  matrixform *= mat
              else:
                  mat = Matrix(
                      [
                          [
                              Rational(1, 2),
                              Rational(1, 2),
                              Rational(1, 2),
                              Rational(1, 2),
                          ],
                          [
                              Rational(1, 2),
                              Rational(1, 2),
                              Rational(-1, 2),
                              Rational(-1, 2),
                          ],
                          [
                              Rational(1, 2),
                              Rational(-1, 2),
                              Rational(1, 2),
                              Rational(-1, 2),
                          ],
                          [
                              Rational(1, 2),
                              Rational(-1, 2),
                              Rational(-1, 2),
                              Rational(1, 2),
                          ],
                      ]
                  )
                  matrixform *= mat
          return matrixform
  
      if self.cartan_type.series == "E":
          matrixform = eye(8)
          for elt in reflections:
              a = int(elt)
              if a == 1:
                  mat = Matrix(
                      [
                          [
                              Rational(3, 4),
                              Rational(1, 4),
                              Rational(1, 4),
                              Rational(1, 4),
                              Rational(1, 4),
                              Rational(1, 4),
                              Rational(1, 4),
                              Rational(-1, 4),
                          ],
                          [
                              Rational(1, 4),
                              Rational(3, 4),
                              Rational(-1, 4),
                              Rational(-1, 4),
                              Rational(-1, 4),
                              Rational(-1, 4),
                              Rational(1, 4),
                              Rational(-1, 4),
                          ],
                          [
                              Rational(1, 4),
                              Rational(-1, 4),
                              Rational(3, 4),
                              Rational(-1, 4),
                              Rational(-1, 4),
                              Rational(-1, 4),
                              Rational(-1, 4),
                              Rational(1, 4),
                          ],
                          [
                              Rational(1, 4),
                              Rational(-1, 4),
                              Rational(-1, 4),
                              Rational(3, 4),
                              Rational(-1, 4),
                              Rational(-1, 4),
                              Rational(-1, 4),
                              Rational(1, 4),
                          ],
                          [
                              Rational(1, 4),
                              Rational(-1, 4),
                              Rational(-1, 4),
                              Rational(-1, 4),
                              Rational(3, 4),
                              Rational(-1, 4),
                              Rational(-1, 4),
                              Rational(1, 4),
                          ],
                          [
                              Rational(1, 4),
                              Rational(-1, 4),
                              Rational(-1, 4),
                              Rational(-1, 4),
                              Rational(-1, 4),
                              Rational(3, 4),
                              Rational(-1, 4),
                              Rational(1, 4),
                          ],
                          [
                              Rational(1, 4),
                              Rational(-1, 4),
                              Rational(-1, 4),
                              Rational(-1, 4),
                              Rational(-1, 4),
                              Rational(-1, 4),
                              Rational(-3, 4),
                              Rational(1, 4),
                          ],
                          [
                              Rational(1, 4),
                              Rational(-1, 4),
                              Rational(-1, 4),
                              Rational(-1, 4),
                              Rational(-1, 4),
                              Rational(-1, 4),
                              Rational(-1, 4),
                              Rational(3, 4),
                          ],
                      ]
                  )
                  matrixform *= mat
              elif a == 2:
                  mat = eye(8)
                  mat[0, 0] = 0
                  mat[0, 1] = -1
                  mat[1, 0] = -1
                  mat[1, 1] = 0
                  matrixform *= mat
              else:
                  mat = eye(8)
                  mat[a - 3, a - 3] = 0
                  mat[a - 3, a - 2] = 1
                  mat[a - 2, a - 3] = 1
                  mat[a - 2, a - 2] = 0
                  matrixform *= mat
          return matrixform
  
      if self.cartan_type.series in ("B", "C"):
          matrixform = eye(n)
          for elt in reflections:
              a = int(elt)
              mat = eye(n)
              if a == 1:
                  mat[0, 0] = -1
                  matrixform *= mat
              else:
                  mat[a - 2, a - 2] = 0
                  mat[a - 2, a - 1] = 1
                  mat[a - 1, a - 2] = 1
                  mat[a - 1, a - 1] = 0
                  matrixform *= mat
          return matrixform
  
file_path: sympy/sympy/liealgebras/weyl_group.py
imports: from .cartan_type import CartanType
  from mpmath import fac
  from sympy.core.backend import Matrix, eye, Rational, igcd
  from sympy.core.basic import Atom
label_desc: Use image node_id 7 for calling the WeylGroup obj's underlying member method code with example usage: obj.matrix_form(weylelt) and returns: matrixform, matrixform, matrixform, matrixform, matrixform, matrixform