פונקציות מתמטיות בפייתון | סט 4 (פונקציות מיוחדות וקבועים)

חלק מהפונקציות המתמטיות נדונות בסט 1 סט 2 וקבוצה 3 פונקציות מתמטיות בפייתון | סט 1 (פונקציות מספריות) פונקציות מתמטיות בפייתון | סט 2 (לוגריתמי ופונקציות כוח) פונקציות מתמטיות בפייתון | סט 3 (פונקציות טריגונומטריות וזוויתיות) פונקציות מיוחדות וקבועים נדונים במאמר זה. 1. 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(3.141592) . 3. ו :- זהו קבוע מובנה שמוציא את ערך של 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 משמש לציון הנקודה הצפה השלילית אינסוף. קבוע זה מוגדר בפיתון 3.5 ומעלה. 5. בשבילך() :- פונקציה זו משמשת לִבדוֹק האם הערך הוא an אינסוף או לא. 6. ב :- קבוע זה מציין ' לא מספר ' בפיתון. קבוע זה מוגדר בפיתון 3.5 ומעלה. 7. isnan() :- פונקציה זו מחזירה נכון אם המספר הוא 'נאן' 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