@@ -1571,7 +1571,8 @@ def __call__(self, *values, **kwargs):
1571
1571
1572
1572
INPUT:
1573
1573
1574
- - ``values`` -- (optional) either a tuple or a dictionary
1574
+ - ``values`` -- (optional) either the values in which the variables
1575
+ will be evaluated or a dictionary.
1575
1576
1576
1577
OUTPUT:
1577
1578
@@ -1594,8 +1595,30 @@ def __call__(self, *values, **kwargs):
1594
1595
Traceback (most recent call last):
1595
1596
...
1596
1597
ValueError: number of arguments does not match number of variables in parent
1598
+
1599
+ It is also possible to use keywords like this::
1600
+
1601
+ sage: A.<x,y,z,t> = GradedCommutativeAlgebra(QQ, degrees=(1, 2, 2, 3))
1602
+ sage: f = x*y - 5*y*z + 7*x*y^2*z^3*t
1603
+ sage: f(x=3)
1604
+ 21*y^2*z^3*t - 5*y*z + 3*y
1605
+ sage: f(t=x,y=z)
1606
+ -5*z^2 + x*z
1607
+
1608
+ If both a dictionary and keywords are used, only the dictionary is
1609
+ considered::
1610
+
1611
+ sage: A.<x,y,z,t> = GradedCommutativeAlgebra(QQ, degrees=(1, 2, 2, 3))
1612
+ sage: f = x*y - 5*y*z + 7*x*y^2*z^3*t
1613
+ sage: f({x:1}, t=x,y=z)
1614
+ 7*y^2*z^3*t - 5*y*z + y
1615
+
1597
1616
"""
1598
1617
gens = self .parent ().gens ()
1618
+ images = list (gens )
1619
+ if values and not isinstance (values [0 ], dict ):
1620
+ for (i , p ) in enumerate (values ):
1621
+ images [i ] = p
1599
1622
if len (values ) == 1 and isinstance (values [0 ], dict ):
1600
1623
images = list (gens )
1601
1624
for (i , g ) in enumerate (gens ):
0 commit comments