Funcții matematice în Python | Setul 4 (Funcții speciale și constante)

Unele dintre funcțiile matematice sunt discutate în setul 1 setul 2 și setul 3 de mai jos Funcții matematice în Python | Setul 1 (Funcții numerice) Funcții matematice în Python | Setul 2 (Funcții logaritmice și de putere) Funcții matematice în Python | Setul 3 (Funcții trigonometrice și unghiulare) Funcțiile și constantele speciale sunt discutate în acest articol. 1. gamma() :- Această funcție este folosită pentru a returna funcția 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 :- Aceasta este o constantă încorporată care emite valoarea lui pi(3,141592) . 3. și :- Aceasta este o constantă încorporată care emite valoarea lui 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 :- Acesta este un constantă infinită pozitivă în virgulă mobilă . -inf este folosit pentru a desemna infinitul negativ în virgulă mobilă. Această constantă este definită în python 3.5 și mai sus. 5. Pentru tine() :- Această funcție este folosită pentru verifica dacă valoarea este an infinit sau nu. 6. în :- Această constantă denotă „ Nu un număr ' în piton. Această constantă este definită în python 3.5 și mai sus. 7. isnan() :- Această funcție revine adevărat dacă numărul este „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