logo

Python의 수학 함수 | 세트 4(특수 기능 및 상수)

일부 수학 함수는 아래 세트 1, 세트 2 및 세트 3에서 설명됩니다. Python의 수학 함수 | 세트 1(숫자 기능) Python의 수학 함수 | 세트 2(로그 및 거듭제곱 함수) Python의 수학 함수 | 세트 3(삼각함수 및 각도 함수) 이 문서에서는 특수 함수와 상수에 대해 설명합니다. 1. 감마() :- 이 함수는 다음을 반환하는 데 사용됩니다. 감마 함수 of the argument. Python
# Python code to demonstrate the working of # gamma() # importing 'math' for mathematical operations import math a = 4 # returning the gamma() of 4 print ('The gamma() of 4 is : ' end='') print (math.gamma(a)) 
Output:
The gamma() of 4 is : 6.0 

2. 파이 :- 이것은 다음을 출력하는 내장 상수입니다. 파이 값(3.141592) . 3. 그리고 :- 이것은 다음을 출력하는 내장 상수입니다. e(2.718281)의 값 . Python
# Python code to demonstrate the working of # const. pi and e # importing 'math' for mathematical operations import math # returning the value of const. pi print ('The value of const. pi is : ' end='') print (math.pi) # returning the value of const. e print ('The value of const. e is : ' end='') print (math.e) 
Output:
The value of const. pi is : 3.141592653589793 The value of const. e is : 2.718281828459045 

4. 인프 :- 이것은 양의 부동 소수점 무한대 상수 . -inf는 음의 부동 소수점 무한대를 나타내는 데 사용됩니다. 이 상수는 Python 3.5 이상에서 정의됩니다. 5. 당신을 위해() :- 이 기능은 다음과 같은 용도로 사용됩니다. 확인하다 값이 무한대인지 아닌지. 6. 에 :- 이 상수는 ' 숫자가 아님 '파이썬으로. 이 상수는 Python 3.5 이상에서 정의됩니다. 7. 이스난() :- 이 함수는 다음을 반환합니다. 숫자가 'nan'이면 true else returns false. Python
# Python code to demonstrate the working of # inf nan isinf() isnan() # importing 'math' for mathematical operations import math # checking if number is nan if (math.isnan(math.nan)): print ('The number is nan') else : print ('The number is not nan') # checking if number is positive infinity if (math.isinf(math.inf)): print ('The number is positive infinity') else : print ('The number is not positive infinity') 
Output:
The number is nan The number is positive infinity