#12448: The binomial implementation does a quotient of gamma values, which is
wrong
------------------------------------+---------------------------------------
Reporter: Snark | Owner: AlexGhitza
Type: defect | Status: needs_work
Priority: minor | Milestone:
Component: basic arithmetic | Resolution:
Keywords: | Work issues:
Report Upstream: N/A | Reviewers:
Authors: | Merged in:
Dependencies: | Stopgaps:
------------------------------------+---------------------------------------
Comment (by ppurka):
The current code (not your patch) looks overly complicated for a binomial
function. What is the definition being used? Can't it simply be defined as
(assuming `m` is an integer):
{{{
x * (x-1)/2 * (x-2)/3 * ... * (x-m+1)/m
}}}
Doesn't this hold irrespective of whether `x` is real or integer? The
above formula also gives a simple way of implementing the binomial. For
`x` integer, the computations from left to right remains an integer all
the time. Secondly the computation remains bounded at all times (if the
binomial is not large) even if the values of `x` and `m` are large. There
is no need to invoke the gamma function. One could also start from the
other end to keep the values during the computations even less (note that
at each step integral values of `x` and `m` implies that the computations
remain integers; so we are not breaking anything):
{{{
(x-m+1) * (x-m+1)/2 * (x-m+3)/3 * ... * x/m
}}}
Am I missing some definition of the binomial here, which contains the
gamma function necessarily?
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12448#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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.