On this page
math.atan2
Prev: math.atan | Up: math | Next: math.atanh
Rel: math.acos, math.acosh, math.asin, math.asinh
Ref: docs.python.org — math.atan2
Tags: #public #python3 #stdlib #math
Import
import math
from math import atan2
Signature & Overview
math.atan2(y, x, /)
Return the arc tangent (measured in radians) of y/x.
Usage
import math
# Note parameter order: atan2(y, x), NOT (x, y)
assert math.isclose(math.atan2(1.0, -1.0), 3 * math.pi / 4)
assert math.isclose(math.atan2(0.0, -1.0), math.pi)
Gotchas
- Argument order is
(y, x): Safely handlesx == 0withoutZeroDivisionErrorand preserves quadrant sign in[-pi, pi].
REPL Inspect
from math import atan2
help(atan2)
Linked from
Related notes
- tuts/python3/stdlib_module/math/atan Linked here; links to this page; shared tags: #math, #stdlib
- tuts/python3/stdlib_module/math/atanh Linked here; links to this page; shared tags: #math, #stdlib
- tuts/python3/stdlib_module/math Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/math/acos Linked here; shared tags: #math, #stdlib
- tuts/python3/stdlib_module/math/acosh Linked here; shared tags: #math, #stdlib
- tuts/python3/stdlib_module/math/asin Linked here; shared tags: #math, #stdlib
- tuts/python3/stdlib_module/math/asinh Linked here; shared tags: #math, #stdlib
- tuts/c/stdlib/math shared tags: #math, #stdlib
- tuts/c/stdlib/math/fabs shared tags: #math, #stdlib
- tuts/c/stdlib/math/floor shared tags: #math, #stdlib