Matematické funkce v Pythonu | Sada 4 (Speciální funkce a konstanty)

Některé z matematických funkcí jsou popsány níže v sadě 1 sada 2 a sada 3 Matematické funkce v Pythonu | Sada 1 (numerické funkce) Matematické funkce v Pythonu | Sada 2 (logaritmické a výkonové funkce) Matematické funkce v Pythonu | Sada 3 (trigonometrické a úhlové funkce) Speciální funkce a konstanty jsou popsány v tomto článku. 1. gama() :- Tato funkce se používá k vrácení funkce 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. pí :- Toto je vestavěná konstanta, která vydává hodnota pí(3,141592) . 3. a :- Toto je vestavěná konstanta, která vydává hodnota 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 :- Toto je a kladná konstanta nekonečna s plovoucí desetinnou čárkou . -inf se používá k označení záporného nekonečna s pohyblivou řádovou čárkou. Tato konstanta je definována v pythonu 3.5 a výše. 5. Pro vás() :- Tato funkce se používá kontrola zda je hodnota an nekonečno nebo ne. 6. v :- Tato konstanta označuje ' Ne číslo “ v pythonu. Tato konstanta je definována v pythonu 3.5 a výše. 7. isnan() :- Tato funkce vrací pravda, pokud je číslo '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