Mathematische Funktionen in Python | Satz 4 (Sonderfunktionen und Konstanten)

Einige der mathematischen Funktionen werden unten in Satz 1, Satz 2 und Satz 3 erläutert Mathematische Funktionen in Python | Satz 1 (Numerische Funktionen) Mathematische Funktionen in Python | Satz 2 (Logarithmische und Potenzfunktionen) Mathematische Funktionen in Python | Satz 3 (Trigonometrische und Winkelfunktionen) Spezielle Funktionen und Konstanten werden in diesem Artikel besprochen. 1. gamma() :- Diese Funktion wird verwendet, um die zurückzugeben Gammafunktion 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 :- Dies ist eine eingebaute Konstante, die das ausgibt Wert von pi(3,141592) . 3. und :- Dies ist eine eingebaute Konstante, die das ausgibt Wert von 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 :- Das ist ein positive Gleitkomma-Unendlichkeitskonstante . -inf wird verwendet, um die negative Gleitkomma-Unendlichkeit zu bezeichnen. Diese Konstante ist in Python 3.5 und höher definiert. 5. Für dich() :- Diese Funktion dient dazu überprüfen ob der Wert ein ist Unendlich oder nicht. 6. in :- Diese Konstante bezeichnet ' Keine Zahl ' in Python. Diese Konstante ist in Python 3.5 und höher definiert. 7. isnan() :- Diese Funktion gibt zurück wahr, wenn die Zahl „nan“ ist 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  

Das Könnte Ihnen Gefallen