Hướng dẫn does python math have factorial? - toán python có giai thừa không?

Cải thiện bài viết

Lưu bài viết

  • Đọc
  • Bàn luận
  • Cải thiện bài viết

    Lưu bài viết

    Đọc

    Bàn luận

    Không nhiều người biết, nhưng Python cung cấp một chức năng trực tiếp có thể tính toán giai thừa của một số mà không viết toàn bộ mã để tính toán.

    Phương pháp ngây thơ để tính toán giai thừa

    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    2
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    3
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    4

    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    5
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    3
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    7

    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    8
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    9
    The factorial of 23 is : 25852016738884976640000
    
    0
    The factorial of 23 is : 25852016738884976640000
    
    1
    The factorial of 23 is : 25852016738884976640000
    
    222

    The factorial of 23 is : 25852016738884976640000
    
    8
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    5
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    3
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    5
    The factorial of -5 is : 
    
    2
    The factorial of -5 is : 
    
    3

    The factorial of -5 is : 
    
    4
    The factorial of 23 is : 25852016738884976640000
    
    2
    The factorial of -5 is : 
    
    6
    The factorial of -5 is : 
    
    7
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    3
    The factorial of -5 is : 
    
    9

    The factorial of 23 is : 25852016738884976640000
    

    The factorial of -5 is : 
    
    4
    Traceback (most recent call last):
      File "/home/f29a45b132fac802d76b5817dfaeb137.py", line 9, in 
        print (math.factorial(-5))
    ValueError: factorial() not defined for negative values
    
    1

    Đầu ra:math” module of python. Because it has C type internal implementation, it is fast.

    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    

    Sử dụng math.factorial ()

    Phương pháp này được định nghĩa trong mô -đun Math Math của Python. Bởi vì nó có loại C thực hiện nội bộ, nó là nhanh.

    Traceback (most recent call last):
      File "/home/f29a45b132fac802d76b5817dfaeb137.py", line 9, in 
        print (math.factorial(-5))
    ValueError: factorial() not defined for negative values
    
    2
    Traceback (most recent call last):
      File "/home/f29a45b132fac802d76b5817dfaeb137.py", line 9, in 
        print (math.factorial(-5))
    ValueError: factorial() not defined for negative values
    
    3

    The factorial of -5 is : 
    
    4
    The factorial of 23 is : 25852016738884976640000
    
    2
    The factorial of -5 is : 
    
    6
    The factorial of -5 is : 
    
    7
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    3
    The factorial of -5 is : 
    
    9

    The factorial of 23 is : 25852016738884976640000
    

    The factorial of -5 is : 
    
    4
    Traceback (most recent call last):
      File "/home/f29a45b132fac802d76b5817dfaeb137.py", line 9, in 
        print (math.factorial(-5))
    ValueError: factorial() not defined for negative values
    
    1

    • Đầu ra:

      Sử dụng math.factorial ()

      Phương pháp này được định nghĩa trong mô -đun Math Math của Python. Bởi vì nó có loại C thực hiện nội bộ, nó là nhanh.

      Traceback (most recent call last):
        File "/home/f29a45b132fac802d76b5817dfaeb137.py", line 9, in 
          print (math.factorial(-5))
      ValueError: factorial() not defined for negative values
      
      2
      Traceback (most recent call last):
        File "/home/f29a45b132fac802d76b5817dfaeb137.py", line 9, in 
          print (math.factorial(-5))
      ValueError: factorial() not defined for negative values
      
      3

      The factorial of -5 is : 
      
      4
      The factorial of 23 is : 25852016738884976640000
      
      2
      The factorial of -5 is : 
      
      6
      The factorial of -5 is : 
      
      7
      math.factorial(x)
      Parameters :
      x : The number whose factorial has to be computed.
      Return value :
      Returns the factorial of desired number.
      Exceptions : 
      Raises Value error if number is negative or non-integral.
      
      3
      The factorial of -5 is : 
      
      9

      The factorial of -5 is : 
      
      4
      Traceback (most recent call last):
        File "/home/f29a45b132fac802d76b5817dfaeb137.py", line 9, in 
          print (math.factorial(-5))
      ValueError: factorial() not defined for negative values
      
      1

      Đầu ra:

      Traceback (most recent call last):
        File "/home/f29a45b132fac802d76b5817dfaeb137.py", line 9, in 
          print (math.factorial(-5))
      ValueError: factorial() not defined for negative values
      
    • Sử dụng math.factorial ()

      Sử dụng math.factorial ()

      Phương pháp này được định nghĩa trong mô -đun Math Math của Python. Bởi vì nó có loại C thực hiện nội bộ, nó là nhanh.

      Traceback (most recent call last):
        File "/home/f29a45b132fac802d76b5817dfaeb137.py", line 9, in 
          print (math.factorial(-5))
      ValueError: factorial() not defined for negative values
      
      2
      Traceback (most recent call last):
        File "/home/f29a45b132fac802d76b5817dfaeb137.py", line 9, in 
          print (math.factorial(-5))
      ValueError: factorial() not defined for negative values
      
      3

      The factorial of -5 is : 
      
      4
      The factorial of 23 is : 25852016738884976640000
      
      2
      The factorial of -5 is : 
      
      6
      The factorial of -5 is : 
      
      7
      math.factorial(x)
      Parameters :
      x : The number whose factorial has to be computed.
      Return value :
      Returns the factorial of desired number.
      Exceptions : 
      Raises Value error if number is negative or non-integral.
      
      3
      The factorial of -5 is : 
      
      9

      The factorial of 5.6 is : 
      

      Đầu ra:

      Traceback (most recent call last):
        File "/home/3987966b8ca9cbde2904ad47dfdec124.py", line 9, in 
          print (math.factorial(5.6))
      ValueError: factorial() only accepts integral values
      

    Sử dụng math.factorial ()Manjeet Singh. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to . See your article appearing on the GeeksforGeeks main page and help other Geeks.

    Phương pháp này được định nghĩa trong mô -đun Math Math của Python. Bởi vì nó có loại C thực hiện nội bộ, nó là nhanh.


    Để tìm giai thừa Python của một số, số được nhân với tất cả các số nguyên nằm giữa 1 và số. Về mặt toán học, nó được đại diện bởi! Vì vậy, ví dụ, 5! sẽ là 5 x 4 x 3 x 2 x 1, đó là 120. Không xác định số gốc cho các số âm.


    Những loại toán học sử dụng giai đoạn nào?

    Trong phân tích toán học, các giai thừa được sử dụng trong chuỗi sức mạnh cho chức năng theo cấp số nhân và các chức năng khác, và chúng cũng có các ứng dụng trong đại số, lý thuyết số, lý thuyết xác suất và khoa học máy tính.

    Phương pháp toán học
    import math

    Thí dụ
    print(math.factorial(9))
    print(math.factorial(6))
    print(math.factorial(12))

    Tìm giai thừa của một số:


    #Trình thư viện toán học Mathimport Toán học

    #Return Factorial của một số in (math.factorial (9)) in (math.factorial (6)) in (math.factorial (12))

    Hãy tự mình thử » This method only accepts positive integers.

    Định nghĩa và cách sử dụng


    Phương thức >>> sum([.1, .1, .1, .1, .1, .1, .1, .1, .1, .1]) 0.9999999999999999 >>> fsum([.1, .1, .1, .1, .1, .1, .1, .1, .1, .1]) 1.0 9 trả về giai thừa của một số.

    Lưu ý: Phương pháp này chỉ chấp nhận số nguyên dương.

    Nấp của một số là tổng của phép nhân, của tất cả các số, từ số được chỉ định của chúng tôi xuống 1. Ví dụ, giai thừa của 6 sẽ là 6 x 5 x 4 x 3 x 2 x 1 = 720Cú pháp
    Giá trị tham sốTham số

    Sự mô tả

    xYêu cầu. Một số nguyên dương. Nếu số là âm, hoặc không phải là một số nguyên, nó sẽ trả về giá trịerror. Nếu giá trị không phải là một số, nó sẽ trả về một kiểu
    Chi tiết kỹ thuật2.6

    Để tìm giai thừa Python của một số, số được nhân với tất cả các số nguyên nằm giữa 1 và số. Về mặt toán học, nó được đại diện bởi! Vì vậy, ví dụ, 5! sẽ là 5 x 4 x 3 x 2 x 1, đó là 120. Không xác định số gốc cho các số âm.



    Để tìm giai thừa Python của một số, số được nhân với tất cả các số nguyên nằm giữa 1 và số. Về mặt toán học, nó được đại diện bởi! Vì vậy, ví dụ, 5! sẽ là 5 x 4 x 3 x 2 x 1, đó là 120. Không xác định số gốc cho các số âm.

    Những loại toán học sử dụng giai đoạn nào?

    Trong phân tích toán học, các giai thừa được sử dụng trong chuỗi sức mạnh cho chức năng theo cấp số nhân và các chức năng khác, và chúng cũng có các ứng dụng trong đại số, lý thuyết số, lý thuyết xác suất và khoa học máy tính.

    Mô -đun này cung cấp quyền truy cập vào các hàm toán học được xác định bởi tiêu chuẩn C.

    Các chức năng này không thể được sử dụng với các số phức tạp; Sử dụng các hàm cùng tên từ mô -đun
    >>> from math import exp, expm1
    >>> exp(1e-5) - 1  # gives result accurate to 11 places
    1.0000050000069649e-05
    >>> expm1(1e-5)    # result accurate to full precision
    1.0000050000166668e-05
    
    1 nếu bạn yêu cầu hỗ trợ cho các số phức. Sự khác biệt giữa các hàm hỗ trợ các số phức và các chức năng mà don được tạo ra vì hầu hết người dùng không muốn học khá nhiều toán học theo yêu cầu để hiểu các số phức tạp. Nhận một ngoại lệ thay vì kết quả phức tạp cho phép phát hiện sớm số phức bất ngờ được sử dụng làm tham số, để lập trình viên có thể xác định cách thức và lý do tại sao nó được tạo ở nơi đầu tiên.
    ceil(x)

    Các chức năng sau được cung cấp bởi mô -đun này. Ngoại trừ khi được ghi nhận rõ ràng khác, tất cả các giá trị trả về đều nổi.

    Các chức năng lý thuyết và đại diện sốcomb(n, k)

    Toán.ceil (x) ¶

    Trả lại trần của x, số nguyên nhỏ nhất lớn hơn hoặc bằng x. Nếu X không phải là một chiếc phao, các đại biểu cho

    >>> from math import exp, expm1
    >>> exp(1e-5) - 1  # gives result accurate to 11 places
    1.0000050000069649e-05
    >>> expm1(1e-5)    # result accurate to full precision
    1.0000050000166668e-05
    
    2, sẽ trả về giá trị
    >>> from math import exp, expm1
    >>> exp(1e-5) - 1  # gives result accurate to 11 places
    1.0000050000069649e-05
    >>> expm1(1e-5)    # result accurate to full precision
    1.0000050000166668e-05
    
    3.

    math.comb (n, k) ¶

    Trả lại số cách để chọn các mục K từ n mục mà không lặp lại và không có thứ tự.

    Đánh giá thành

    >>> from math import exp, expm1
    >>> exp(1e-5) - 1  # gives result accurate to 11 places
    1.0000050000069649e-05
    >>> expm1(1e-5)    # result accurate to full precision
    1.0000050000166668e-05
    
    4 khi
    >>> from math import exp, expm1
    >>> exp(1e-5) - 1  # gives result accurate to 11 places
    1.0000050000069649e-05
    >>> expm1(1e-5)    # result accurate to full precision
    1.0000050000166668e-05
    
    5 và đánh giá về 0 khi
    >>> from math import exp, expm1
    >>> exp(1e-5) - 1  # gives result accurate to 11 places
    1.0000050000069649e-05
    >>> expm1(1e-5)    # result accurate to full precision
    1.0000050000166668e-05
    
    6.

    Cũng được gọi là hệ số nhị thức vì nó tương đương với hệ số của thuật ngữ K-th trong mở rộng đa thức
    >>> from math import exp, expm1
    >>> exp(1e-5) - 1  # gives result accurate to 11 places
    1.0000050000069649e-05
    >>> expm1(1e-5)    # result accurate to full precision
    1.0000050000166668e-05
    
    7.
    copysign(x, y)

    Tăng

    >>> from math import exp, expm1
    >>> exp(1e-5) - 1  # gives result accurate to 11 places
    1.0000050000069649e-05
    >>> expm1(1e-5)    # result accurate to full precision
    1.0000050000166668e-05
    
    8 nếu một trong những đối số không phải là số nguyên. Tăng
    >>> from math import exp, expm1
    >>> exp(1e-5) - 1  # gives result accurate to 11 places
    1.0000050000069649e-05
    >>> expm1(1e-5)    # result accurate to full precision
    1.0000050000166668e-05
    
    9 nếu một trong những đối số là tiêu cực.

    Mới trong phiên bản 3.8.fabs(x)

    math.copysign (x, y) ¶

    Trả về một chiếc phao với cường độ (giá trị tuyệt đối) của x nhưng dấu hiệu của y. Trên các nền tảng hỗ trợ các số không có chữ ký,
    sqrt(sum((px - qx) ** 2.0 for px, qx in zip(p, q)))
    
    0 trả về -1.0.
    factorial(n)

    Math.fabs (x)

    Trả về giá trị tuyệt đối của x.Accepting floats with integral values (like

    sqrt(sum((px - qx) ** 2.0 for px, qx in zip(p, q)))
    
    2) is deprecated.

    Math.Factorial (n) ¶floor(x)

    Trả lại n giai thừa như một số nguyên. Tăng

    >>> from math import exp, expm1
    >>> exp(1e-5) - 1  # gives result accurate to 11 places
    1.0000050000069649e-05
    >>> expm1(1e-5)    # result accurate to full precision
    1.0000050000166668e-05
    
    9 nếu N không phải là tích hợp hoặc âm tính.

    math.fmod (x, y) ¶fmod(x, y)

    Trả về

    sqrt(sum((px - qx) ** 2.0 for px, qx in zip(p, q)))
    
    5, theo định nghĩa của thư viện nền tảng C. Lưu ý rằng biểu thức Python
    sqrt(sum((px - qx) ** 2.0 for px, qx in zip(p, q)))
    
    6 có thể không trả về kết quả tương tự. Mục đích của tiêu chuẩn C là
    sqrt(sum((px - qx) ** 2.0 for px, qx in zip(p, q)))
    
    5 chính xác (về mặt toán học; đến độ chính xác vô hạn) bằng
    sqrt(sum((px - qx) ** 2.0 for px, qx in zip(p, q)))
    
    8 đối với một số số nguyên n sao cho kết quả có cùng dấu với x và độ lớn nhỏ hơn
    sqrt(sum((px - qx) ** 2.0 for px, qx in zip(p, q)))
    
    9. Thay vào đó, Python từ ____996 trả về kết quả với dấu hiệu của Y và có thể không chính xác tính toán cho các đối số nổi. Ví dụ,
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    01 là
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    02, nhưng kết quả của Python, ____ ____103 là
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    04, không thể được biểu diễn chính xác dưới dạng phao, và làm tròn đến
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    05 đáng ngạc nhiên. Vì lý do này, chức năng
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    06 thường được ưa thích khi làm việc với phao, trong khi Python, ____ ____996 được ưa thích khi làm việc với các số nguyên.

    math.frexp (x) ¶frexp(x)

    Trả lại mantissa và số mũ của X là cặp

    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    08. M là một chiếc phao và E là một số nguyên sao cho chính xác ____1099. Nếu x bằng 0, trả về
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    10, nếu không
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    11. Điều này được sử dụng để chọn cách xa nhau, biểu diễn bên trong của một chiếc phao một cách di động.

    math.fsum (có thể lặp lại) ¶fsum(iterable)

    Trả về một tổng điểm nổi chính xác của các giá trị trong itable. Tránh mất độ chính xác bằng cách theo dõi nhiều khoản tiền trung gian:

    >>> sum([.1, .1, .1, .1, .1, .1, .1, .1, .1, .1])
    0.9999999999999999
    >>> fsum([.1, .1, .1, .1, .1, .1, .1, .1, .1, .1])
    1.0
    

    Độ chính xác của thuật toán phụ thuộc vào các đảm bảo số học của IEEE-754 và trường hợp điển hình trong đó chế độ làm tròn là nửa giờ. Trên một số bản dựng không phải Windows, thư viện C cơ bản sử dụng bổ sung chính xác mở rộng và đôi khi có thể đôi một tổng trung gian khiến nó bị tắt trong bit ít quan trọng nhất của nó.

    Để thảo luận thêm và hai cách tiếp cận thay thế, hãy xem các công thức nấu ăn Cookbook ASPN để tổng hợp điểm nổi chính xác.

    math.gcd (*số nguyên) ¶gcd(*integers)

    Trả về ước số chung lớn nhất của các đối số số nguyên được chỉ định. Nếu bất kỳ đối số nào là khác không, thì giá trị trả về là số nguyên dương lớn nhất là ước số của tất cả các đối số. Nếu tất cả các đối số bằng không, thì giá trị trả về là

    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    12.
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    13 mà không có đối số trả về
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    12.

    Mới trong phiên bản 3.5.

    Đã thay đổi trong phiên bản 3.9: Đã thêm hỗ trợ cho một số lượng đối số tùy ý. Trước đây, chỉ có hai cuộc tranh luận được hỗ trợ.Added support for an arbitrary number of arguments. Formerly, only two arguments were supported.

    math.isclose (a, b, *, rel_tol = 1e-09, abs_tol = 0,0) ¶isclose(a, b, *, rel_tol=1e-09, abs_tol=0.0)

    Trả về

    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    15 Nếu các giá trị A và B gần nhau và
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    16 khác.

    Việc hai giá trị có được coi là đóng được xác định theo dung sai tuyệt đối và tương đối hay không.

    rel_tol là dung sai tương đối - đó là sự khác biệt tối đa được phép giữa A và B, so với giá trị tuyệt đối lớn hơn của a hoặc b. Ví dụ, để đặt dung sai 5%, vượt qua

    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    17. Dung sai mặc định là
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    18, đảm bảo rằng hai giá trị giống nhau trong khoảng 9 chữ số thập phân. rel_tol phải lớn hơn 0.

    ABS_TOL là dung sai tuyệt đối tối thiểu - hữu ích cho việc so sánh gần bằng không. abs_tol phải ít nhất bằng không.

    Nếu không có lỗi xảy ra, kết quả sẽ là:

    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    19.

    Các giá trị đặc biệt của IEEE 754 của

    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    20,
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    21 và
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    22 sẽ được xử lý theo quy tắc của IEEE. Cụ thể,
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    20 không được coi là gần với bất kỳ giá trị nào khác, bao gồm
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    20.
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    21 và
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    22 chỉ được coi là gần gũi với chính họ.

    Mới trong phiên bản 3.5.

    Đã thay đổi trong phiên bản 3.9: Đã thêm hỗ trợ cho một số lượng đối số tùy ý. Trước đây, chỉ có hai cuộc tranh luận được hỗ trợ.

    math.isclose (a, b, *, rel_tol = 1e-09, abs_tol = 0,0) ¶ – A function for testing approximate equality

    Trả về
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    15 Nếu các giá trị A và B gần nhau và
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    16 khác.
    isfinite(x)

    Việc hai giá trị có được coi là đóng được xác định theo dung sai tuyệt đối và tương đối hay không.

    rel_tol là dung sai tương đối - đó là sự khác biệt tối đa được phép giữa A và B, so với giá trị tuyệt đối lớn hơn của a hoặc b. Ví dụ, để đặt dung sai 5%, vượt qua

    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    17. Dung sai mặc định là
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    18, đảm bảo rằng hai giá trị giống nhau trong khoảng 9 chữ số thập phân. rel_tol phải lớn hơn 0.

    ABS_TOL là dung sai tuyệt đối tối thiểu - hữu ích cho việc so sánh gần bằng không. abs_tol phải ít nhất bằng không.isinf(x)

    Nếu không có lỗi xảy ra, kết quả sẽ là:

    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    19.

    Các giá trị đặc biệt của IEEE 754 của
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    20,
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    21 và
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    22 sẽ được xử lý theo quy tắc của IEEE. Cụ thể,
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    20 không được coi là gần với bất kỳ giá trị nào khác, bao gồm
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    20.
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    21 và
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    22 chỉ được coi là gần gũi với chính họ.
    isnan(x)

    Xem thêm

    PEP 485 - một chức năng để kiểm tra sự bình đẳng gần đúngisqrt(n)

    math.isfinite (x) ¶

    Trả lại

    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    15 nếu X không phải là vô cực cũng không phải là NAN và
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    16 nếu không. (Lưu ý rằng
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    29 được coi là hữu hạn.)

    Mới trong phiên bản 3.2.

    math.isinf (x) ¶lcm(*integers)

    Trả lại

    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    15 nếu x là vô cực dương hoặc âm và
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    16 nếu không.

    math.isnan (x) ¶

    Trả về
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    15 nếu X là NAN (không phải là số) và
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    16 nếu không.
    ldexp(x, i)

    math.isqrt (n) ¶

    math.modf (x) ¶modf(x)

    Trả về các phần phân số và số nguyên của x. Cả hai kết quả đều mang dấu hiệu của X và là phao.

    math.nextafter (x, y) ¶nextafter(x, y)

    Trả lại giá trị điểm nổi tiếp theo sau X về phía y.

    Nếu x bằng y, trả lại y.

    Examples:

    • math.factorial(x)
      Parameters :
      x : The number whose factorial has to be computed.
      Return value :
      Returns the factorial of desired number.
      Exceptions : 
      Raises Value error if number is negative or non-integral.
      
      40 đi lên: Hướng tới vô cùng tích cực.

    • math.factorial(x)
      Parameters :
      x : The number whose factorial has to be computed.
      Return value :
      Returns the factorial of desired number.
      Exceptions : 
      Raises Value error if number is negative or non-integral.
      
      41 đi xuống: Hướng tới trừ vô cùng.

    • math.factorial(x)
      Parameters :
      x : The number whose factorial has to be computed.
      Return value :
      Returns the factorial of desired number.
      Exceptions : 
      Raises Value error if number is negative or non-integral.
      
      42 đi về phía 0.

    • math.factorial(x)
      Parameters :
      x : The number whose factorial has to be computed.
      Return value :
      Returns the factorial of desired number.
      Exceptions : 
      Raises Value error if number is negative or non-integral.
      
      43 biến mất khỏi số không.

    Xem thêm

    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    44.

    Mới trong phiên bản 3.9.

    math.perm (n, k = none) ¶perm(n, k=None)

    Trả lại số cách để chọn các mục K từ N các mục mà không cần lặp lại và theo thứ tự.

    Đánh giá thành

    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    45 khi
    >>> from math import exp, expm1
    >>> exp(1e-5) - 1  # gives result accurate to 11 places
    1.0000050000069649e-05
    >>> expm1(1e-5)    # result accurate to full precision
    1.0000050000166668e-05
    
    5 và đánh giá về 0 khi
    >>> from math import exp, expm1
    >>> exp(1e-5) - 1  # gives result accurate to 11 places
    1.0000050000069649e-05
    >>> expm1(1e-5)    # result accurate to full precision
    1.0000050000166668e-05
    
    6.

    Nếu k không được chỉ định hoặc không có, thì k mặc định cho n và hàm trả về

    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    48.

    Tăng

    >>> from math import exp, expm1
    >>> exp(1e-5) - 1  # gives result accurate to 11 places
    1.0000050000069649e-05
    >>> expm1(1e-5)    # result accurate to full precision
    1.0000050000166668e-05
    
    8 nếu một trong những đối số không phải là số nguyên. Tăng
    >>> from math import exp, expm1
    >>> exp(1e-5) - 1  # gives result accurate to 11 places
    1.0000050000069649e-05
    >>> expm1(1e-5)    # result accurate to full precision
    1.0000050000166668e-05
    
    9 nếu một trong những đối số là tiêu cực.

    Mới trong phiên bản 3.8.

    math.prod (có thể lặp lại, *, start = 1) ¶prod(iterable, *, start=1)

    Tính toán sản phẩm của tất cả các yếu tố trong đầu vào có thể. Giá trị khởi động mặc định cho sản phẩm là

    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    37.

    Khi có thể trống, trả lại giá trị bắt đầu. Hàm này được dự định cụ thể để sử dụng với các giá trị số và có thể từ chối các loại không phải là số.

    Mới trong phiên bản 3.8.

    math.prod (có thể lặp lại, *, start = 1) ¶remainder(x, y)

    Tính toán sản phẩm của tất cả các yếu tố trong đầu vào có thể. Giá trị khởi động mặc định cho sản phẩm là

    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    37.

    Khi có thể trống, trả lại giá trị bắt đầu. Hàm này được dự định cụ thể để sử dụng với các giá trị số và có thể từ chối các loại không phải là số.

    Math.Remainder (x, y) ¶

    Trả lại phần còn lại theo kiểu IEEE 754 của X đối với y. Đối với hữu hạn x và hữu hạn khác Y, đây là sự khác biệt

    sqrt(sum((px - qx) ** 2.0 for px, qx in zip(p, q)))
    
    8, trong đó
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    53 là số nguyên gần nhất với giá trị chính xác của thương số
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    54. Nếu
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    55 là chính xác giữa hai số nguyên liên tiếp, thì số nguyên gần nhất được sử dụng cho
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    53. Do đó, phần còn lại
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    57 luôn thỏa mãn
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    58.

    Các trường hợp đặc biệt theo IEEE 754: Đặc biệt,
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    59 là X cho bất kỳ X hữu hạn nào và
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    60 và
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    61 tăng
    >>> from math import exp, expm1
    >>> exp(1e-5) - 1  # gives result accurate to 11 places
    1.0000050000069649e-05
    >>> expm1(1e-5)    # result accurate to full precision
    1.0000050000166668e-05
    
    9 cho bất kỳ NaN X nào. Nếu kết quả của hoạt động còn lại bằng không, số 0 đó sẽ có cùng dấu với x.
    trunc(x)

    Trên các nền tảng sử dụng điểm nổi nhị phân của IEEE 754, kết quả của hoạt động này luôn có thể thể hiện chính xác: không có lỗi làm tròn được đưa ra.

    Mới trong phiên bản 3.7.ulp(x)

    math.trunc (x) ¶

    • Trả lại x với phần phân số được loại bỏ, để lại phần số nguyên. Vòng này hướng tới 0:

      math.factorial(x)
      Parameters :
      x : The number whose factorial has to be computed.
      Return value :
      Returns the factorial of desired number.
      Exceptions : 
      Raises Value error if number is negative or non-integral.
      
      63 tương đương với
      math.factorial(x)
      Parameters :
      x : The number whose factorial has to be computed.
      Return value :
      Returns the factorial of desired number.
      Exceptions : 
      Raises Value error if number is negative or non-integral.
      
      64 cho x dương tính và tương đương với
      math.factorial(x)
      Parameters :
      x : The number whose factorial has to be computed.
      Return value :
      Returns the factorial of desired number.
      Exceptions : 
      Raises Value error if number is negative or non-integral.
      
      65 đối với x âm. Nếu X không phải là một chiếc phao, các đại biểu cho
      math.factorial(x)
      Parameters :
      x : The number whose factorial has to be computed.
      Return value :
      Returns the factorial of desired number.
      Exceptions : 
      Raises Value error if number is negative or non-integral.
      
      66, sẽ trả về giá trị
      >>> from math import exp, expm1
      >>> exp(1e-5) - 1  # gives result accurate to 11 places
      1.0000050000069649e-05
      >>> expm1(1e-5)    # result accurate to full precision
      1.0000050000166668e-05
      
      3.

    • toán.ulp (x) ¶

    • Trả về giá trị của bit ít đáng kể nhất của phao X:

    • Nếu x là nan (không phải là số), hãy trả lại x.

    • Nếu x là âm, hãy trả về

      math.factorial(x)
      Parameters :
      x : The number whose factorial has to be computed.
      Return value :
      Returns the factorial of desired number.
      Exceptions : 
      Raises Value error if number is negative or non-integral.
      
      68.

    • Nếu x là vô cực dương, hãy trả lại x.

    Nếu x bằng 0, trả lại phao có thể biểu thị dương tính nhỏ nhất (nhỏ hơn phao chuẩn hóa dương tối thiểu,

    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    69).

    Nếu X bằng với phao nổi tích dương lớn nhất, hãy trả về giá trị của bit X đáng kể nhất, sao cho chiếc phao đầu tiên nhỏ hơn X là

    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    70.

    Mới trong phiên bản 3.9.

    math.perm (n, k = none) ¶

    Trả lại số cách để chọn các mục K từ N các mục mà không cần lặp lại và theo thứ tự.

    Đánh giá thành math.factorial(x) Parameters : x : The number whose factorial has to be computed. Return value : Returns the factorial of desired number. Exceptions : Raises Value error if number is negative or non-integral. 45 khi >>> from math import exp, expm1 >>> exp(1e-5) - 1 # gives result accurate to 11 places 1.0000050000069649e-05 >>> expm1(1e-5) # result accurate to full precision 1.0000050000166668e-05 5 và đánh giá về 0 khi >>> from math import exp, expm1 >>> exp(1e-5) - 1 # gives result accurate to 11 places 1.0000050000069649e-05 >>> expm1(1e-5) # result accurate to full precision 1.0000050000166668e-05 6.

    Nếu k không được chỉ định hoặc không có, thì k mặc định cho n và hàm trả về
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    48.
    cbrt(x)

    Tăng

    >>> from math import exp, expm1
    >>> exp(1e-5) - 1  # gives result accurate to 11 places
    1.0000050000069649e-05
    >>> expm1(1e-5)    # result accurate to full precision
    1.0000050000166668e-05
    
    8 nếu một trong những đối số không phải là số nguyên. Tăng
    >>> from math import exp, expm1
    >>> exp(1e-5) - 1  # gives result accurate to 11 places
    1.0000050000069649e-05
    >>> expm1(1e-5)    # result accurate to full precision
    1.0000050000166668e-05
    
    9 nếu một trong những đối số là tiêu cực.

    Mới trong phiên bản 3.8.

    math.prod (có thể lặp lại, *, start = 1) ¶exp(x)

    Tính toán sản phẩm của tất cả các yếu tố trong đầu vào có thể. Giá trị khởi động mặc định cho sản phẩm là

    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    37.

    Khi có thể trống, trả lại giá trị bắt đầu. Hàm này được dự định cụ thể để sử dụng với các giá trị số và có thể từ chối các loại không phải là số.exp2(x)

    Math.Remainder (x, y) ¶

    Mới trong phiên bản 3.8.

    math.prod (có thể lặp lại, *, start = 1) ¶expm1(x)

    Tính toán sản phẩm của tất cả các yếu tố trong đầu vào có thể. Giá trị khởi động mặc định cho sản phẩm là

    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    37.

    >>> from math import exp, expm1
    >>> exp(1e-5) - 1  # gives result accurate to 11 places
    1.0000050000069649e-05
    >>> expm1(1e-5)    # result accurate to full precision
    1.0000050000166668e-05
    

    Khi có thể trống, trả lại giá trị bắt đầu. Hàm này được dự định cụ thể để sử dụng với các giá trị số và có thể từ chối các loại không phải là số.

    Math.Remainder (x, y) ¶log(x[, base])

    Trả lại phần còn lại theo kiểu IEEE 754 của X đối với y. Đối với hữu hạn x và hữu hạn khác Y, đây là sự khác biệt

    sqrt(sum((px - qx) ** 2.0 for px, qx in zip(p, q)))
    
    8, trong đó
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    53 là số nguyên gần nhất với giá trị chính xác của thương số
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    54. Nếu
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    55 là chính xác giữa hai số nguyên liên tiếp, thì số nguyên gần nhất được sử dụng cho
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    53. Do đó, phần còn lại
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    57 luôn thỏa mãn
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    58.

    Các trường hợp đặc biệt theo IEEE 754: Đặc biệt,

    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    59 là X cho bất kỳ X hữu hạn nào và
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    60 và
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    61 tăng
    >>> from math import exp, expm1
    >>> exp(1e-5) - 1  # gives result accurate to 11 places
    1.0000050000069649e-05
    >>> expm1(1e-5)    # result accurate to full precision
    1.0000050000166668e-05
    
    9 cho bất kỳ NaN X nào. Nếu kết quả của hoạt động còn lại bằng không, số 0 đó sẽ có cùng dấu với x.

    Trên các nền tảng sử dụng điểm nổi nhị phân của IEEE 754, kết quả của hoạt động này luôn có thể thể hiện chính xác: không có lỗi làm tròn được đưa ra.log1p(x)

    Mới trong phiên bản 3.7.

    Math.log2 (x) ¶log2(x)

    Trả về logarit cơ sở-2 của x. Điều này thường chính xác hơn

    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    85.

    Mới trong phiên bản 3.3.

    Xem thêm

    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    86 Trả về số lượng bit cần thiết để biểu thị số nguyên trong nhị phân, không bao gồm dấu hiệu và số không hàng đầu.

    Math.log10 (x) ¶log10(x)

    Trả về logarit cơ sở-10 của x. Điều này thường chính xác hơn

    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    87.

    Toán.pow (x, y) ¶pow(x, y)

    Trả lại

    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    88 được nâng lên cho sức mạnh
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    89. Các trường hợp đặc biệt tuân theo tiêu chuẩn IEEE 754 càng xa càng tốt. Cụ thể,
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    90 và
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    91 luôn trả lại
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    92, ngay cả khi
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    88 là số 0 hoặc NAN. Nếu cả
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    88 và
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    89 đều hữu hạn,
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    88 đều âm và
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    89 không phải là số nguyên thì
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    98 không được xác định và tăng
    >>> from math import exp, expm1
    >>> exp(1e-5) - 1  # gives result accurate to 11 places
    1.0000050000069649e-05
    >>> expm1(1e-5)    # result accurate to full precision
    1.0000050000166668e-05
    
    9.

    Không giống như toán tử

    The factorial of 23 is : 25852016738884976640000
    
    00 tích hợp,
    The factorial of 23 is : 25852016738884976640000
    
    01 chuyển đổi cả hai đối số của nó thành loại
    The factorial of 23 is : 25852016738884976640000
    
    02. Sử dụng
    The factorial of 23 is : 25852016738884976640000
    
    00 hoặc hàm
    The factorial of 23 is : 25852016738884976640000
    
    04 tích hợp để tính toán sức mạnh số nguyên chính xác.

    Thay đổi trong phiên bản 3.11: Các trường hợp đặc biệt

    The factorial of 23 is : 25852016738884976640000
    
    05 và
    The factorial of 23 is : 25852016738884976640000
    
    06 đã được thay đổi thành trả lại
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    21 thay vì tăng
    >>> from math import exp, expm1
    >>> exp(1e-5) - 1  # gives result accurate to 11 places
    1.0000050000069649e-05
    >>> expm1(1e-5)    # result accurate to full precision
    1.0000050000166668e-05
    
    9, để thống nhất với IEEE 754.The special cases
    The factorial of 23 is : 25852016738884976640000
    
    05 and
    The factorial of 23 is : 25852016738884976640000
    
    06 were changed to return
    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    21 instead of raising
    >>> from math import exp, expm1
    >>> exp(1e-5) - 1  # gives result accurate to 11 places
    1.0000050000069649e-05
    >>> expm1(1e-5)    # result accurate to full precision
    1.0000050000166668e-05
    
    9, for consistency with IEEE 754.

    math.sqrt (x) ¶sqrt(x)

    Trả về căn bậc hai của x.

    Hàm lượng giác¶

    Math.acos (x) ¶acos(x)

    Trả lại cosin hồ quang của X, trong radian. Kết quả là giữa

    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    12 và
    The factorial of 23 is : 25852016738884976640000
    
    10.

    math.asin (x) ¶asin(x)

    Trả lại sin hồ quang của X, trong radian. Kết quả là giữa

    The factorial of 23 is : 25852016738884976640000
    
    11 và
    The factorial of 23 is : 25852016738884976640000
    
    12.

    Math.atan (x) ¶atan(x)

    Trả lại tiếp tuyến vòng cung của X, trong radian. Kết quả là giữa

    The factorial of 23 is : 25852016738884976640000
    
    11 và
    The factorial of 23 is : 25852016738884976640000
    
    12.

    math.atan2 (y, x)atan2(y, x)

    Trả lại

    The factorial of 23 is : 25852016738884976640000
    
    15, trong radian. Kết quả là giữa
    The factorial of 23 is : 25852016738884976640000
    
    16 và
    The factorial of 23 is : 25852016738884976640000
    
    10. Vectơ trong mặt phẳng từ gốc đến điểm
    The factorial of 23 is : 25852016738884976640000
    
    18 làm cho góc này với trục X dương. Điểm của
    The factorial of 23 is : 25852016738884976640000
    
    19 là các dấu hiệu của cả hai đầu vào được biết đến, do đó nó có thể tính toán góc phần tư chính xác cho góc. Ví dụ,
    The factorial of 23 is : 25852016738884976640000
    
    20 và
    The factorial of 23 is : 25852016738884976640000
    
    21 đều là
    The factorial of 23 is : 25852016738884976640000
    
    22, nhưng
    The factorial of 23 is : 25852016738884976640000
    
    23 là
    The factorial of 23 is : 25852016738884976640000
    
    24.

    Toán.cos (x) ¶cos(x)

    Trả lại cosin của X radian.

    Tath.Dist (P, Q) ¶dist(p, q)

    Trả về khoảng cách Euclide giữa hai điểm P và Q, mỗi điểm được đưa ra dưới dạng một chuỗi (hoặc có thể lặp lại) của tọa độ. Hai điểm phải có cùng một chiều.

    Tương đương với:

    sqrt(sum((px - qx) ** 2.0 for px, qx in zip(p, q)))
    

    Mới trong phiên bản 3.8.

    Toán.hypot (*tọa độ) ¶hypot(*coordinates)

    Trả lại định mức Euclide,

    The factorial of 23 is : 25852016738884976640000
    
    25. Đây là độ dài của vectơ từ gốc đến điểm được đưa ra bởi tọa độ.

    Đối với một điểm hai chiều

    The factorial of 23 is : 25852016738884976640000
    
    18, điều này tương đương với việc tính toán hypotenuse của một tam giác vuông bằng định lý Pythagore,
    The factorial of 23 is : 25852016738884976640000
    
    27.

    Đã thay đổi trong phiên bản 3.8: Đã thêm hỗ trợ cho các điểm N chiều. Trước đây, chỉ có trường hợp hai chiều được hỗ trợ.Added support for n-dimensional points. Formerly, only the two dimensional case was supported.

    Đã thay đổi trong phiên bản 3.10: Cải thiện độ chính xác của thuật toán để lỗi tối đa nằm dưới 1 ULP (đơn vị ở vị trí cuối cùng). Thông thường hơn, kết quả hầu như luôn được làm tròn chính xác trong vòng 1/2 ULP.Improved the algorithm’s accuracy so that the maximum error is under 1 ulp (unit in the last place). More typically, the result is almost always correctly rounded to within 1/2 ulp.

    math.sin (x) ¶sin(x)

    Trả lại sin của X radian.

    Toán.tan (x) ¶tan(x)

    Trả lại tiếp tuyến của radian x.

    Chuyển đổi góc cạnh

    math.degrees (x) ¶degrees(x)

    Chuyển đổi góc X từ radian sang độ.

    Math.radians (x)radians(x)

    Chuyển đổi góc x từ độ sang radian.

    Chức năng Hyperbolic

    Các hàm hyperbol là các hàm tương tự của các hàm lượng giác dựa trên hyperbolas thay vì các vòng tròn.

    Math.acosh (x) ¶acosh(x)

    Trả lại cosin hyperbol nghịch đảo của x.

    math.asinh (x) ¶asinh(x)

    Trả lại sin hyperbol nghịch đảo của x.

    Math.atanh (x) ¶atanh(x)

    Trả lại tiếp tuyến hyperbol nghịch đảo của x.

    Math.Cosh (x) ¶cosh(x)

    Trả lại cosin hyperbol của x.

    Math.sinh (x) ¶sinh(x)

    Trả lại sin hyperbolic của x.

    Toán.tanh (x) ¶tanh(x)

    Trả lại tiếp tuyến hyperbol của x.

    Chức năng đặc biệt¶

    math.erf (x) ¶erf(x)

    Trả về hàm lỗi tại x.

    Hàm

    The factorial of 23 is : 25852016738884976640000
    
    28 có thể được sử dụng để tính toán các chức năng thống kê truyền thống như phân phối bình thường tiêu chuẩn tích lũy:

    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    0

    Mới trong phiên bản 3.2.

    math.erfc (x)erfc(x)

    Trả về hàm lỗi bổ sung tại x. Hàm lỗi bổ sung được định nghĩa là

    The factorial of 23 is : 25852016738884976640000
    
    29. Nó được sử dụng cho các giá trị lớn của X trong đó phép trừ từ một sẽ gây ra mất ý nghĩa.

    Mới trong phiên bản 3.2.

    math.erfc (x)gamma(x)

    Trả về hàm lỗi bổ sung tại x. Hàm lỗi bổ sung được định nghĩa là

    The factorial of 23 is : 25852016738884976640000
    
    29. Nó được sử dụng cho các giá trị lớn của X trong đó phép trừ từ một sẽ gây ra mất ý nghĩa.

    Mới trong phiên bản 3.2.

    math.erfc (x)lgamma(x)

    Trả về hàm lỗi bổ sung tại x. Hàm lỗi bổ sung được định nghĩa là

    The factorial of 23 is : 25852016738884976640000
    
    29. Nó được sử dụng cho các giá trị lớn của X trong đó phép trừ từ một sẽ gây ra mất ý nghĩa.

    Mới trong phiên bản 3.2.

    math.erfc (x)

    Trả về hàm lỗi bổ sung tại x. Hàm lỗi bổ sung được định nghĩa là
    The factorial of 23 is : 25852016738884976640000
    
    29. Nó được sử dụng cho các giá trị lớn của X trong đó phép trừ từ một sẽ gây ra mất ý nghĩa.
    pi

    Math.gamma (x)

    Trả lại hàm gamma tại x.e

    Math.lgamma (x) ¶

    Trả về logarit tự nhiên của giá trị tuyệt đối của hàm gamma tại x.tau

    Hằng số trong

    Mới trong phiên bản 3.6.

    Toán học.inf¶inf

    Một điểm vô cực tích cực điểm nổi. (Đối với vô cực âm, sử dụng

    The factorial of 23 is : 25852016738884976640000
    
    30.) Tương đương với đầu ra của
    The factorial of 23 is : 25852016738884976640000
    
    31.

    Mới trong phiên bản 3.5.

    toán học.nan¶nan

    Một điểm nổi, không phải là một giá trị số (NAN). Tương đương với đầu ra của

    The factorial of 23 is : 25852016738884976640000
    
    32. Do các yêu cầu của tiêu chuẩn IEEE-754,
    The factorial of 23 is : 25852016738884976640000
    
    33 và
    The factorial of 23 is : 25852016738884976640000
    
    32 không được coi là bằng với bất kỳ giá trị số nào khác, bao gồm cả chính chúng. Để kiểm tra xem một số là NAN, hãy sử dụng hàm
    The factorial of 23 is : 25852016738884976640000
    
    35 để kiểm tra NAN thay vì
    The factorial of 23 is : 25852016738884976640000
    
    36 hoặc
    The factorial of 23 is : 25852016738884976640000
    
    37. Thí dụ:

    math.factorial(x)
    Parameters :
    x : The number whose factorial has to be computed.
    Return value :
    Returns the factorial of desired number.
    Exceptions : 
    Raises Value error if number is negative or non-integral.
    
    1

    Đã thay đổi trong phiên bản 3.11: Bây giờ luôn luôn có sẵn.It is now always available.

    Mới trong phiên bản 3.5.

    toán học.nan¶ The

    The factorial of 23 is : 25852016738884976640000
    
    38 module consists mostly of thin wrappers around the platform C math library functions. Behavior in exceptional cases follows Annex F of the C99 standard where appropriate. The current implementation will raise
    >>> from math import exp, expm1
    >>> exp(1e-5) - 1  # gives result accurate to 11 places
    1.0000050000069649e-05
    >>> expm1(1e-5)    # result accurate to full precision
    1.0000050000166668e-05
    
    9 for invalid operations like
    The factorial of 23 is : 25852016738884976640000
    
    40 or
    The factorial of 23 is : 25852016738884976640000
    
    41 (where C99 Annex F recommends signaling invalid operation or divide-by-zero), and
    The factorial of 23 is : 25852016738884976640000
    
    42 for results that overflow (for example,
    The factorial of 23 is : 25852016738884976640000
    
    43). A NaN will not be returned from any of the functions above unless one or more of the input arguments was a NaN; in that case, most functions will return a NaN, but (again following C99 Annex F) there are some exceptions to this rule, for example
    The factorial of 23 is : 25852016738884976640000
    
    44 or
    The factorial of 23 is : 25852016738884976640000
    
    45.

    Một điểm nổi, không phải là một giá trị số (NAN). Tương đương với đầu ra của

    The factorial of 23 is : 25852016738884976640000
    
    32. Do các yêu cầu của tiêu chuẩn IEEE-754,
    The factorial of 23 is : 25852016738884976640000
    
    33 và
    The factorial of 23 is : 25852016738884976640000
    
    32 không được coi là bằng với bất kỳ giá trị số nào khác, bao gồm cả chính chúng. Để kiểm tra xem một số là NAN, hãy sử dụng hàm
    The factorial of 23 is : 25852016738884976640000
    
    35 để kiểm tra NAN thay vì
    The factorial of 23 is : 25852016738884976640000
    
    36 hoặc
    The factorial of 23 is : 25852016738884976640000
    
    37. Thí dụ:

    Đã thay đổi trong phiên bản 3.11: Bây giờ luôn luôn có sẵn.

    Chi tiết triển khai CPYThon: Mô -đun
    The factorial of 23 is : 25852016738884976640000
    
    38 bao gồm hầu hết các trình bao bọc mỏng xung quanh các chức năng thư viện toán học nền tảng C. Hành vi trong các trường hợp đặc biệt theo Phụ lục F của tiêu chuẩn C99 khi thích hợp. Việc triển khai hiện tại sẽ tăng
    >>> from math import exp, expm1
    >>> exp(1e-5) - 1  # gives result accurate to 11 places
    1.0000050000069649e-05
    >>> expm1(1e-5)    # result accurate to full precision
    1.0000050000166668e-05
    
    9 cho các hoạt động không hợp lệ như
    The factorial of 23 is : 25852016738884976640000
    
    40 hoặc
    The factorial of 23 is : 25852016738884976640000
    
    41 (trong đó Phụ lục C99 F khuyến nghị báo hiệu hoạt động không hợp lệ hoặc chia rẽ-bằng không) và
    The factorial of 23 is : 25852016738884976640000
    
    42 cho kết quả tràn (ví dụ:
    The factorial of 23 is : 25852016738884976640000
    
    43). Một NAN sẽ không được trả lại từ bất kỳ chức năng nào ở trên trừ khi một hoặc nhiều đối số đầu vào là NAN; Trong trường hợp đó, hầu hết các chức năng sẽ trả về NAN, nhưng (một lần nữa sau C99 Phụ lục F) Có một số ngoại lệ cho quy tắc này, ví dụ
    The factorial of 23 is : 25852016738884976640000
    
    44 hoặc
    The factorial of 23 is : 25852016738884976640000
    
    45.

    Lưu ý rằng Python không nỗ lực để phân biệt tín hiệu Nans với Nans yên tĩnh và hành vi để báo hiệu NAN vẫn không được xác định. Hành vi điển hình là đối xử với tất cả các Nans như thể họ im lặng.

    Xem thêm

    Để tìm giai thừa Python của một số, số được nhân với tất cả các số nguyên nằm giữa 1 và số.Về mặt toán học, nó được đại diện bởi!Vì vậy, ví dụ, 5!sẽ là 5 x 4 x 3 x 2 x 1, đó là 120. Không xác định số gốc cho các số âm.the number is multiplied with all the integers that lie between 1 and the number itself. Mathematically, it is represented by “!”. Thus, for example, 5! will be 5 x 4 x 3 x 2 x 1, that is 120. Factorial for negative numbers is not defined.

    Những loại toán học sử dụng giai đoạn nào?

    Trong phân tích toán học, các giai thừa được sử dụng trong chuỗi sức mạnh cho chức năng theo cấp số nhân và các chức năng khác, và chúng cũng có các ứng dụng trong đại số, lý thuyết số, lý thuyết xác suất và khoa học máy tính.power series for the exponential function and other functions, and they also have applications in algebra, number theory, probability theory, and computer science.