logo

Python'da Matematiksel Fonksiyonlar | Set 4 (Özel Fonksiyonlar ve Sabitler)

Matematiksel fonksiyonlardan bazıları aşağıdaki set 1 set 2 ve set 3'te tartışılmaktadır. Python'da Matematiksel Fonksiyonlar | Set 1 (Sayısal Fonksiyonlar) Python'da Matematiksel Fonksiyonlar | Set 2 (Logaritmik ve Güç Fonksiyonları) Python'da Matematiksel Fonksiyonlar | Set 3 (Trigonometrik ve Açısal Fonksiyonlar) Bu makalede özel işlevler ve sabitler ele alınmıştır. 1. gama() : - Bu işlev, geri dönmek için kullanılır. gama işlevi 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 : - Bu, çıktıyı veren dahili bir sabittir. pi'nin değeri(3,141592) . 3. ve : - Bu, çıktıyı veren dahili bir sabittir. e'nin değeri(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. enf pozitif kayan nokta sonsuzluk sabiti . -inf negatif kayan nokta sonsuzluğunu belirtmek için kullanılır. Bu sabit python 3.5 ve üzeri sürümlerde tanımlanmıştır. : - Bu işlev şunun için kullanılır: kontrol etmek sonsuzluk ya da değil. 6. içinde :- Bu sabit ' ' in python. Bu sabit python 3.5 ve üzeri sürümlerde tanımlanmıştır. sayı 'nan' ise doğru 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