#18390: cleanup variable factories
-------------------------------------+------------------------
Reporter: vdelecroix | Owner:
Type: enhancement | Status: new
Priority: major | Milestone: sage-6.7
Component: algebra | Resolution:
Keywords: | Merged in:
Authors: Vincent Delecroix | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
Dependencies: | Stopgaps:
-------------------------------------+------------------------
Description changed by vdelecroix:
Old description:
> The `PolynomialRing` factory is written in a very complicated way and is
> slightly different to `FreeAlgebra`. In this ticket, we normalize the
> inputs of all factories involving variables.
>
> Some changes are noticeable
>
> 1. the following will now raise `TypeError`
> {{{
> sage: R.<a,b> = PolynomialRing(QQ, ('a', 'b'))
> sage: A.<x,y,z> = FreeAlgebra(QQ, 'x,y,z')
> }}}
>
> 2. The many versions are `normalize_names` are fused in
> `sage.misc.variables.normalize_names`
>
> 3. Deprecations:
> - the `var_array` argument in `PolynomialRing`
> - the methods `normalize_names`, `_certify_name` of `CategoryObject`
>
> As a sided effect, we got some speedup in polynomial ring creation!
New description:
Various parents need to create variable names (the polynomial rings, free
algebras, groups, the symbolic ring, etc). We fusion all of them.
1. the following will now raise `TypeError`
{{{
sage: R.<a,b> = PolynomialRing(QQ, ('a', 'b'))
sage: A.<x,y,z> = FreeAlgebra(QQ, 'x,y,z')
}}}
(see [https://groups.google.com/forum/#!topic/sage-devel/DRT84Yj73Nc the
"polynomial ring" thread])
2. The many versions are `normalize_names` are fused in
`sage.misc.variables.normalize_names`
3. Deprecations:
- the `var_array` argument in `PolynomialRing`
- the methods `normalize_names`, `_certify_name` of `CategoryObject`
4. Problems with injection of reserved names
{{{
sage: a = SR.var('or') # this should work
Traceback (most recent call last):
...
ValueError: The name "or" is not a valid Python identifier.
sage: QQ['or'].inject_variables() # this should not
Defining or
}}}
note: should take care of '_', 'True', 'False', 'None' and builtins (see
[https://groups.google.com/forum/#!topic/sage-devel/5BAtCZnQj6o the
"reserved name for variables" thread])
As a sided effect, we got some speedup in polynomial ring creation!
See also:
- [https://groups.google.com/forum/#!topic/sage-devel/Z7rXiKaMbOk
"polynomial ring (bis)" thread] about the allowed form for creation of
`PolynomialRing`, `FreeAlgebra`, etc
--
--
Ticket URL: <http://trac.sagemath.org/ticket/18390#comment:3>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.