Fonctions mathématiques en Python | Ensemble 4 (fonctions spéciales et constantes)

Certaines des fonctions mathématiques sont abordées dans les ensembles 1, 2 et 3 ci-dessous. Fonctions mathématiques en Python | Ensemble 1 (fonctions numériques) Fonctions mathématiques en Python | Ensemble 2 (fonctions logarithmiques et puissance) Fonctions mathématiques en Python | Ensemble 3 (fonctions trigonométriques et angulaires) Les fonctions spéciales et les constantes sont abordées dans cet article. 1. gamma() :- Cette fonction est utilisée pour renvoyer le fonction 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 :- Il s'agit d'une constante intégrée qui génère le valeur de pi(3,141592) . 3. et :- Il s'agit d'une constante intégrée qui génère le valeur 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. fam :- C'est un constante infinie positive à virgule flottante . -inf est utilisé pour désigner l'infini négatif à virgule flottante. Cette constante est définie dans python 3.5 et supérieur. 5. Pour vous() :- Cette fonction est utilisée pour vérifier si la valeur est une l'infini ou pas. 6. dans :- Cette constante désigne ' Pas un numéro ' en python. Cette constante est définie dans python 3.5 et supérieur. 7. isnan() :- Cette fonction renvoie vrai si le numéro est '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