bundles / scipy 1.17.1 / scipy / special / _basic / perm
function
scipy.special._basic:perm
source: /scipy/special/_basic.py :2565
Signature
def perm ( N , k , exact = False ) Summary
Permutations of N things taken k at a time, i.e., k-permutations of N.
Extended Summary
It's also known as "partial permutations".
Parameters
N: int, ndarrayNumber of things.
k: int, ndarrayNumber of elements taken.
exact: bool, optionalIf
True, calculate the answer exactly using long integer arithmetic (Nandkmust be scalar integers). IfFalse, a floating point approximation is calculated (more rapidly) using poch. Default isFalse.
Returns
val: int, ndarrayThe number of k-permutations of N.
Notes
Array arguments accepted only for exact=False case.
If k > N, N < 0, or k < 0, then a 0 is returned.
Examples
import numpy as np from scipy.special import perm k = np.array([3, 4]) n = np.array([10, 10])✓
perm(n, k)
✗perm(10, 3, exact=True)
✓Aliases
-
scipy.special.perm