logo

الدوال الرياضية في بايثون | المجموعة 4 (الوظائف الخاصة والثوابت)

تمت مناقشة بعض الوظائف الرياضية في المجموعة 1 والمجموعة 2 والمجموعة 3 أدناه الدوال الرياضية في بايثون | المجموعة 1 (الوظائف الرقمية) الدوال الرياضية في بايثون | المجموعة 2 (الوظائف اللوغاريتمية والطاقة) الدوال الرياضية في بايثون | المجموعة 3 (الدوال المثلثية والزاوية) تمت مناقشة الوظائف الخاصة والثوابت في هذه المقالة. 1. جاما () :- تستخدم هذه الدالة لإرجاع ملف وظيفة جاما 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. بي :- هذا ثابت يحمل في ثناياه عوامل إخراج ملف قيمة باي (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. لك() :- تستخدم هذه الوظيفة ل يفحص ما إذا كانت القيمة ما لا نهاية أم لا. 6. في :- هذا الثابت يدل على ' ليس رقما " في بيثون. يتم تعريف هذا الثابت في بيثون 3.5 وما فوق. 7. إسنان() :- ترجع هذه الدالة صحيح إذا كان الرقم "نان" 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