Latest web development tutorials

fonction Python atan2 ()

chiffres Python chiffres Python


description

atan2 () Renvoie l'arctangente de coordonnées X et Y des valeurs.


grammaire

Ce qui suit est la syntaxe de méthode atan2 ():

import math

math.atan2(y, x)

Note: atan2 () ne sont pas directement accessibles, vous devez importer le module de mathématiques, puis appeler la méthode par mathématiques objets statiques.


Paramètres

  • x - une valeur.
  • y - une valeur.

Valeur de retour

Renvoie l'arctangente de coordonnées X et Y des valeurs.


Exemples

Le tableau suivant montre un exemple de l'utilisation de atan2 () Méthode:

#!/usr/bin/python
import math

print "atan2(-0.50,-0.50) : ",  math.atan2(-0.50,-0.50)
print "atan2(0.50,0.50) : ",  math.atan2(0.50,0.50)
print "atan2(5,5) : ",  math.atan2(5,5)
print "atan2(-10,10) : ",  math.atan2(-10,10)
print "atan2(10,20) : ",  math.atan2(10,20)

Après avoir exécuté l'exemple ci-dessus est sortie:

atan2(-0.50,-0.50) :  -2.35619449019
atan2(0.50,0.50) :  0.785398163397
atan2(5,5) :  0.785398163397
atan2(-10,10) :  -0.785398163397
atan2(10,20) :  0.463647609001

chiffres Python chiffres Python