Matematikai függvények Pythonban | 4. készlet (speciális függvények és állandók)

Néhány matematikai függvényt az alábbi 1. halmaz 2. és 3. halmaz tárgyal Matematikai függvények Pythonban | 1. készlet (numerikus függvények) Matematikai függvények Pythonban | 2. halmaz (logaritmikus és hatványfüggvények) Matematikai függvények Pythonban | 3. halmaz (trigonometrikus és szögfüggvények) Ebben a cikkben a speciális függvényeket és állandókat tárgyaljuk. 1. gamma() :- Ez a funkció a gamma függvény 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 :- Ez egy beépített állandó, amely a pi(3,141592) értéke . 3. és :- Ez egy beépített állandó, amely a e(2,718281) értéke . 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 :- Ez a pozitív lebegőpontos végtelen állandó . -inf a negatív lebegőpontos végtelen jelölésére szolgál. Ezt az állandót a python 3.5 és újabb verziói határozzák meg. 5. Neked() :- Ezt a funkciót használják ellenőrzés hogy az érték an végtelen vagy sem. 6. be :- Ez a konstans azt jelenti, hogy Nem szám ' pythonban. Ezt az állandót a python 3.5 és újabb verziói határozzák meg. 7. isnan() :- Ez a függvény visszatér igaz, ha a szám „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  

Lehet, Hogy Tetszeni Fog