Latest web development tutorials

fonction atan2 python3 ()

python3 numérique python3 numérique


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/python3
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.356194490192345
atan2(0.50,0.50) :  0.7853981633974483
atan2(5,5) :  0.7853981633974483
atan2(-10,10) :  -0.7853981633974483
atan2(10,20) :  0.4636476090008061

python3 numérique python3 numérique