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 Show
Lưu bài viết 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 : 258520167388849766400000 The factorial of 23 is : 258520167388849766400001 The factorial of 23 is : 25852016738884976640000222 The factorial of 23 is : 258520167388849766400008 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 : 258520167388849766400002 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
Đầ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 values2 Traceback (most recent call last): File "/home/f29a45b132fac802d76b5817dfaeb137.py", line 9, in print (math.factorial(-5)) ValueError: factorial() not defined for negative values3 The factorial of -5 is :4 The factorial of 23 is : 258520167388849766400002 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
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 Thí dụ 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.
Sự mô tả
Để 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-051 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-052, 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-053. 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-057.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-058 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-059 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-059 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 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:
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-055 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-056. 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-058 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-059 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 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-059 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) ¶
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-058 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-059 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-059 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-059. Không giống như toán tử The factorial of 23 is : 2585201673888497664000000 tích hợp, The factorial of 23 is : 2585201673888497664000001 chuyển đổi cả hai đối số của nó thành loại The factorial of 23 is : 2585201673888497664000002. Sử dụng The factorial of 23 is : 2585201673888497664000000 hoặc hàm The factorial of 23 is : 2585201673888497664000004 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 : 2585201673888497664000005 and The factorial of 23 is : 2585201673888497664000006 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-059, 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 : 2585201673888497664000010. 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 : 2585201673888497664000011 và The factorial of 23 is : 2585201673888497664000012. 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 : 2585201673888497664000011 và The factorial of 23 is : 2585201673888497664000012. math.atan2 (y, x)atan2(y, x)¶ Trả lại The factorial of 23 is : 2585201673888497664000015, trong radian. Kết quả là giữa The factorial of 23 is : 2585201673888497664000016 và The factorial of 23 is : 2585201673888497664000010. Vectơ trong mặt phẳng từ gốc đến điểm The factorial of 23 is : 2585201673888497664000018 làm cho góc này với trục X dương. Điểm của The factorial of 23 is : 2585201673888497664000019 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 : 2585201673888497664000020 và The factorial of 23 is : 2585201673888497664000021 đều là The factorial of 23 is : 2585201673888497664000022, nhưng The factorial of 23 is : 2585201673888497664000023 là The factorial of 23 is : 2585201673888497664000024. 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 : 2585201673888497664000025. Đâ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 : 2585201673888497664000018, đ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 : 2585201673888497664000027. Đã 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ạnhmath.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 HyperbolicCá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 : 2585201673888497664000028 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 : 2585201673888497664000029. 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 : 2585201673888497664000029. 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 : 2585201673888497664000029. 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 : 2585201673888497664000029. 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 : 2585201673888497664000030.) Tương đương với đầu ra của The factorial of 23 is : 2585201673888497664000031. 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 : 2585201673888497664000032. Do các yêu cầu của tiêu chuẩn IEEE-754, The factorial of 23 is : 2585201673888497664000033 và The factorial of 23 is : 2585201673888497664000032 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 : 2585201673888497664000035 để kiểm tra NAN thay vì The factorial of 23 is : 2585201673888497664000036 hoặc The factorial of 23 is : 2585201673888497664000037. 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 : 2585201673888497664000038 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-059 for invalid operations like The factorial of 23 is : 2585201673888497664000040 or The factorial of 23 is : 2585201673888497664000041 (where C99 Annex F recommends signaling invalid operation or divide-by-zero), and The factorial of 23 is : 2585201673888497664000042 for results that overflow (for example, The factorial of 23 is : 2585201673888497664000043). 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 : 2585201673888497664000044 or The factorial of 23 is : 2585201673888497664000045. 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 : 2585201673888497664000032. Do các yêu cầu của tiêu chuẩn IEEE-754, The factorial of 23 is : 2585201673888497664000033 và The factorial of 23 is : 2585201673888497664000032 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 : 2585201673888497664000035 để kiểm tra NAN thay vì The factorial of 23 is : 2585201673888497664000036 hoặc The factorial of 23 is : 2585201673888497664000037. 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ô -đunThe factorial of 23 is : 2585201673888497664000038 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-059 cho các hoạt động không hợp lệ như The factorial of 23 is : 2585201673888497664000040 hoặc The factorial of 23 is : 2585201673888497664000041 (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 : 2585201673888497664000042 cho kết quả tràn (ví dụ: The factorial of 23 is : 2585201673888497664000043). 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 : 2585201673888497664000044 hoặc The factorial of 23 is : 2585201673888497664000045. 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. |