Matemātiskās funkcijas Python | 4. kopa (īpašās funkcijas un konstantes)

Dažas no matemātiskajām funkcijām ir aplūkotas tālāk 1. komplektā 2 un 3. komplektā Matemātiskās funkcijas Python | 1. kopa (ciparu funkcijas) Matemātiskās funkcijas Python | 2. kopa (logaritmiskās un jaudas funkcijas) Matemātiskās funkcijas Python | 3. kopa (trigonometriskās un leņķiskās funkcijas) Šajā rakstā ir apskatītas īpašās funkcijas un konstantes. 1. gamma() :- Šī funkcija tiek izmantota, lai atgrieztu gamma funkcija 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 :- Šī ir iebūvēta konstante, kas izvada pi(3,141592) vērtība . 3. un :- Šī ir iebūvēta konstante, kas izvada e vērtība (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 :- Šis ir a pozitīva peldošā punkta bezgalības konstante . -inf lieto, lai apzīmētu negatīvo peldošā komata bezgalību. Šī konstante ir definēta python 3.5 un jaunākās versijās. 5. Tev () :- Šī funkcija tiek izmantota pārbaudiet vai vērtība ir an bezgalība vai nē. 6. iekšā :- Šī konstante apzīmē ' Nevis cipars ' Python. Šī konstante ir definēta python 3.5 un jaunākās versijās. 7. isnan() :- Šī funkcija atgriežas patiess, ja skaitlis ir "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