logo

Funções matemáticas em Python | Conjunto 4 (Funções Especiais e Constantes)

Algumas das funções matemáticas são discutidas abaixo no conjunto 1, conjunto 2 e conjunto 3 Funções matemáticas em Python | Conjunto 1 (Funções Numéricas) Funções matemáticas em Python | Conjunto 2 (funções logarítmicas e de potência) Funções matemáticas em Python | Conjunto 3 (Funções Trigonométricas e Angulares) Funções especiais e constantes são discutidas neste artigo. 1. gama() :- Esta função é usada para retornar o função gama 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.pi : - Esta é uma constante embutida que gera o valor de pi(3,141592) . 3. e : - Esta é uma constante embutida que gera o valor de 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. informações :- Este é um constante infinita de ponto flutuante positivo . -inf é usado para denotar o infinito de ponto flutuante negativo. Esta constante é definida em python 3.5 e superior. 5. Para você() :- Esta função é usada para verificar se o valor é um infinito ou não. 6. em : - Esta constante denota ' Não é um número 'em python. Esta constante é definida em python 3.5 e superior. 7. isnan() : - Esta função retorna verdadeiro se o número for 'nan' 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