@@ -445,6 +445,8 @@ def __init__(self, R):
445445        if  R .ngens () !=  1 :
446446            raise  ValueError ("must be 1 generator" )
447447        LaurentPolynomialRing_generic .__init__ (self , R )
448+         from  sage .rings .integer_ring  import  IntegerRing 
449+         self ._indices  =  IntegerRing ()
448450
449451    Element  =  LaurentPolynomial_univariate 
450452
@@ -561,6 +563,12 @@ def _element_constructor_(self, x):
561563
562564        return  self .element_class (self , x )
563565
566+     def  monomial (self , arg ):
567+         r""" 
568+         Return the monomial with the given exponent. 
569+         """ 
570+         return  self .element_class (self , {arg : self .base_ring ().one ()})
571+ 
564572    def  __reduce__ (self ):
565573        """ 
566574        Used in pickling. 
@@ -591,6 +599,9 @@ def __init__(self, R):
591599        if  not  R .base_ring ().is_integral_domain ():
592600            raise  ValueError ("base ring must be an integral domain" )
593601        LaurentPolynomialRing_generic .__init__ (self , R )
602+         from  sage .modules .free_module  import  FreeModule 
603+         from  sage .rings .integer_ring  import  IntegerRing 
604+         self ._indices  =  FreeModule (IntegerRing (), R .ngens ())
594605
595606    Element  =  LazyImport ('sage.rings.polynomial.laurent_polynomial_mpair' , 'LaurentPolynomial_mpair' )
596607
@@ -605,7 +616,7 @@ def _repr_(self):
605616        """ 
606617        return  "Multivariate Laurent Polynomial Ring in %s over %s"  %  (", " .join (self ._R .variable_names ()), self ._R .base_ring ())
607618
608-     def  monomial (self , * args ):
619+     def  monomial (self , * exponents ):
609620        r""" 
610621        Return the monomial whose exponents are given in argument. 
611622
@@ -629,14 +640,27 @@ def monomial(self, *args):
629640            sage: L.monomial(1, 2, 3)                                                   # needs sage.modules 
630641            Traceback (most recent call last): 
631642            ... 
632-             TypeError: tuple key must have same length as ngens 
633-         """ 
634-         if  len (args ) !=  self .ngens ():
635-             raise  TypeError ("tuple key must have same length as ngens" )
643+             TypeError: tuple key (1, 2, 3) must have same length as ngens (= 2) 
644+ 
645+         We also allow to specify the exponents in a single tuple:: 
646+ 
647+             sage: L.monomial((-1, 2))                                                   # needs sage.modules 
648+             x0^-1*x1^2 
636649
650+             sage: L.monomial((-1, 2, 3))                                                # needs sage.modules 
651+             Traceback (most recent call last): 
652+             ... 
653+             TypeError: tuple key (-1, 2, 3) must have same length as ngens (= 2) 
654+         """ 
637655        from  sage .rings .polynomial .polydict  import  ETuple 
638-         m  =  ETuple (args , int (self .ngens ()))
639-         return  self .element_class (self , self .polynomial_ring ().one (), m )
656+         if  len (exponents ) ==  1  and  isinstance ((e  :=  exponents [0 ]), (tuple , ETuple )):
657+             exponents  =  e 
658+ 
659+         if  len (exponents ) !=  self .ngens ():
660+             raise  TypeError (f"tuple key { exponents } { self .ngens ()}  )
661+ 
662+         m  =  ETuple (exponents , int (self .ngens ()))
663+         return  self .element_class (self , self .polynomial_ring ().base_ring ().one (), m )
640664
641665    def  _element_constructor_ (self , x , mon = None ):
642666        """ 
0 commit comments