Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
5.3.3 - English

Change language to:
Français - 日本語 - Português

Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function

Scilab help >> Elementary Functions > Discrete mathematics > factorial

factorial

The factorial function

Calling Sequence

f = factorial ( n )

Parameters

n :

a matrix of doubles. Must contain positive integers.

f :

a matrix of doubles.

Description

Returns the factorial of n, that is, the product of all integers 1 * 2 * ... * n.

This function overflows as soon as n>170.

Examples

// Make a table of factorial
n = (0:30)';
[n factorial(n)]

// See the limits of factorial: f(171)=%inf
factorial(170) // 7.257415615307998967e306
factorial(171) // %inf

// Plot the function on all its range.
scf();
plot ( 1:170 , factorial , "b-o" )
h = gcf();
h.children.log_flags="nln";

Authors

  • Copyright (C) 2011 - DIGITEO - Michael Baudin
  • Copyright (C) INRIA - Farid BELAHCENE

Bibliography

"Introduction to discrete probabilities", Michael Baudin, 2010

<< factor Discrete mathematics perms >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Wed Oct 05 12:09:38 CEST 2011