Subfactorial

버전 1.0.0.0 (1.71 KB) 작성자: Yash
Calculate subfactorial of integers up to 170.
다운로드 수: 453
업데이트 2009/6/26

라이선스 보기

Usage :
r = subfactorial(n) calculates the subfactorial of a non -negative integer (n) using the inclusion-exclusion principle.
The subfactorial can be written as,
!n = n! sum( (-1)^k / k! ), for k = 0 to n
!n : subfactorial(n)
n! : factorial(n) = 1*2*3*...*n

Remark :
This function is limited by largest floating point number that can be
defined, as given by the realmax. Since,
subfactorial(170) < realmax < subfactorial(171)
Maximum value of input (n) cannot exceed 170.
Higher value of (n) will return NaN.

Example:
a = subfactorial(12);
returns -> a = 176214841

See Also:
factorial

인용 양식

Yash (2026). Subfactorial (https://kr.mathworks.com/matlabcentral/fileexchange/24566-subfactorial), MATLAB Central File Exchange. 검색 날짜: .

MATLAB 릴리스 호환 정보
개발 환경: R12
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Logical에 대해 자세히 알아보기
버전 게시됨 릴리스 정보
1.0.0.0