#16051: fast_callable can return ipow with exponents in the base ring
-------------------------------------+-------------------------------------
Reporter: bhutz | Owner: bhutz
Type: defect | Status: needs_review
Priority: minor | Milestone: sage-6.2
Component: misc | Resolution:
Keywords: | Merged in:
Authors: Ben Hutz | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/bhutz/ticket/16051 | 27663feffb8cf5325b6ea4c8c2f2dd793775ce23
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Comment (by nbruin):
I think parent, when it is available, is a more reliable attribute to
determine the mathematical identity of an element (and hence with what
constants it can be folded). I think `sage.structure.parent` is the right
routine to use, because it will fall back on `type` if `parent` is not
available:
{{{
sage: parent(1)
Integer Ring
sage: parent(int(1))
<type 'int'>
sage: parent(ZZ)
<type 'sage.rings.integer_ring.IntegerRing_class'>
}}}
One example where going by `parent` is ostensibly better than going by
`type` is:
{{{
sage: a=RealField(1000)(1)
sage: b=RealField(200)(1)
sage: a==b
True
sage: (type(a),a)==(type(b),b)
True
sage: (parent(a),a)==(parent(b),b)
False
}}}
We shouldn't be folding constants that have different precision.
I don't have examples available, but it's certainly not ruled out that
elements of different types could have the same parent (to allow for
different representation methods in the same parent, for instance). I
don't know if we should be folding constants in those cases.
In any of the cases where this matters other than to distinguish integer
powers from from other constants one is really stretching the application
domain of `fast_callable` anyway.
--
Ticket URL: <http://trac.sagemath.org/ticket/16051#comment:4>
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.