[SciPy-user] Python fn for Pascal's coefficient?
Robert Kern
robert.kern@gmail....
Tue Jun 10 01:39:45 CDT 2008
On Tue, Jun 10, 2008 at 01:28, Stephen McInerney
<spmcinerney@hotmail.com> wrote:
> Sorry to ask such a basic question, but I searched and I can't find
> a function for Pascal's coefficient, either in standard Python, SciPy or
> NumPy.
I presume you mean a function for the binomial coefficients ("Pascal's
coefficient" appears to be a fairly rare term, at least in English
usage).
http://en.wikipedia.org/wiki/Binomial_coefficient
In [3]: from scipy.misc import comb
In [4]: comb?
Type: function
Base Class: <type 'function'>
String Form: <function comb at 0x1b33d70>
Namespace: Interactive
File: /Users/rkern/svn/scipy/scipy/misc/common.py
Definition: comb(N, k, exact=0)
Docstring:
Combinations of N things taken k at a time.
If exact==0, then floating point precision is used, otherwise
exact long integer is computed.
Notes:
- Array arguments accepted only for exact=0 case.
- If k > N, N < 0, or k < 0, then a 0 is returned.
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
-- Umberto Eco
More information about the SciPy-user
mailing list