sage: R. = QQ[]
sage: preparse("R. = QQ[]")
"R = QQ['a, b, c']; (a, b, c,) = R._first_ngens(Integer(3))"
Now everything is crystal clear! Let's study what QQ is:
sage: QQ?
Type: RationalField
Base Class:
String Form: Rational Field
Namespace: Interactive
Docstring:
The class class{RationalField} represents the field Q of
rational numbers.
Cool, why not. So what is the _first_ngens method doing? Let's find out:
sage: R._first_ngens?
Type: builtin_function_or_method
Base Class:
String Form:
Namespace: Interactive
Hm, not really useful. Let's push harder:
sage: R._first_ngens??
Type: builtin_function_or_method
Base Class:
String Form:
Namespace: Interactive
Source:
def _first_ngens(self, n):
v = self.gens()
return v[:n]
So the equivalent code is this:
sage: R.gens()
(a, b, c)
sage: R.gens()[:3]
(a, b, c)
Cool, why not. So what is the R.gens() doing?
sage: R.gens?
Type: builtin_function_or_method
Base Class:
String Form:
Namespace: Interactive
Docstring:
Return the tuple of variables in self.
EXAMPLES:
sage: P.= QQ[]
sage: P.gens()
(x, y, z)
sage: P = MPolynomialRing(QQ,10,'x')
sage: P.gens()
(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9)
sage: P.= MPolynomialRing(QQ,2) # weird names
sage: P.gens()
(SAGE, SINGULAR)
Ah, that's the answer we want. :)
No comments:
Post a Comment