pythontr.com
Python cos() fonksiyonun sözdizimi aşağıdaki gibidir.
import math math.cos(x)
Bu fonksiyona doğrudan erişilemez erişmek için math paketinin import edilmesi gerekir. Import edildikten sonra math paketi üzerinden çağrılarak kullanılır.
Bu fonksiyon, açının kosinüsünü temsil eden -1 ile 1 arasında sayısal bir değer döndürür.
Aşağıdaki örnek, cos() fonksiyonun kullanımını gösterir.
>>> import math >>> print "cos(3) : ", math.cos(3) cos(3) : -0.9899924966 >>> print "cos(-3) : ", math.cos(-3) cos(-3) : -0.9899924966 >>> print "cos(0) : ", math.cos(0) cos(0) : 1.0 >>> print "cos(math.pi) : ", math.cos(math.pi) cos(math.pi) : -1.0 >>> print "cos(2*math.pi) : ", math.cos(2*math.pi) cos(2*math.pi) : 1.0
Yorumlar