#15003: calling factorials of RIF
-------------------------------------+-------------------------------------
Reporter: dkrenn | Owner:
Type: defect | Status: needs_review
Priority: minor | Milestone: sage-6.2
Component: numerical | Resolution:
Keywords: factorial RIF | Merged in:
RealIntervalField calling | Reviewers:
inconsistent beginner | Work issues:
Authors: | Commit:
Report Upstream: N/A | 217ec553285573cc342cf44e6620297e22533e19
Branch: | Stopgaps:
u/amitjamadagni/ticket/15003 |
Dependencies: |
-------------------------------------+-------------------------------------
Comment (by ppurka):
Thanks for the changes! I have some reservations in giving this a positive
review in its ''current'' form. This needs a review by someone who knows
why the factorial function is implemented as it is currently -- it is
implemented as a class. So, let's hope someone knowledgeable comes along
and takes a look at this ticket. :)
I have been looking at the different fields. Except for `ZZ` and `SR`,
none of them have `factorial()` method defined. If indeed this method is
introduced, it should be introduced in many places where it makes sense
(e.g. `CC`, `RR`, `RDF`, `QQ`, etc), if only to redirect to the generic
function call `factorial(self)`; like
{{{
def factorial(self):
return sage.functions.other.factorial(self)
}}}
About your implementation: there is no need to call `RIF`. The addition
already returns an element of RIF. I am saying this just for any future
modifications you make to the functions; in some cases (but not this
factorial function) it can make improvements :)
{{{
sage: a = RIF(2.5, 4.5)
sage: a+1
1.?e1
sage: %timeit RIF(a+1)
100000 loops, best of 3: 7.54 us per loop
sage: %timeit a+1
100000 loops, best of 3: 4.75 us per loop
}}}
For the factorial function itself, speed wise there is no difference since
the gamma function is much slower than this `RIF` call!
{{{
sage: %timeit (a+1).gamma()
1000 loops, best of 3: 240 us per loop
sage: %timeit RIF(a+1).gamma()
1000 loops, best of 3: 243 us per loop
}}}
--
Ticket URL: <http://trac.sagemath.org/ticket/15003#comment:11>
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/groups/opt_out.