logo

Funciones matemáticas en Python | Conjunto 4 (Funciones especiales y constantes)

Algunas de las funciones matemáticas se analizan a continuación en el conjunto 1, el conjunto 2 y el conjunto 3. Funciones matemáticas en Python | Conjunto 1 (Funciones numéricas) Funciones matemáticas en Python | Conjunto 2 (Funciones logarítmicas y de potencia) Funciones matemáticas en Python | Conjunto 3 (Funciones trigonométricas y angulares) Las funciones especiales y las constantes se analizan en este artículo. 1. gama() :- Esta función se utiliza para devolver el función gamma 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 es una constante incorporada que genera la valor de pi(3.141592) . 3. y :- Esta es una constante incorporada que genera la 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. inf :- Este es un Constante infinita de coma flotante positiva . -inf se utiliza para indicar el infinito de punto flotante negativo. Esta constante está definida en Python 3.5 y superior. 5. Para ti() :- Esta función se utiliza para controlar si el valor es un infinito o no. 6. en :- Esta constante denota ' no es un numero ' en pitón. Esta constante está definida en Python 3.5 y superior. 7. isnan() :- Esta función devuelve verdadero si el número es '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