Skip to content

Commit 58774c7

Browse files
committed
Improve documentation
1 parent f933f0c commit 58774c7

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

src/sage/algebras/commutative_dga.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1571,7 +1571,8 @@ def __call__(self, *values, **kwargs):
15711571
15721572
INPUT:
15731573
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.
15751576
15761577
OUTPUT:
15771578
@@ -1594,8 +1595,30 @@ def __call__(self, *values, **kwargs):
15941595
Traceback (most recent call last):
15951596
...
15961597
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+
15971616
"""
15981617
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
15991622
if len(values) == 1 and isinstance(values[0], dict):
16001623
images = list(gens)
16011624
for (i, g) in enumerate(gens):

0 commit comments

Comments
 (0)