CKTIS / Python
math.cos
Berekent de cosinus van een hoek in radialen, de horizontale coördinaat op de eenheidscirkel.
Versie: Python 3.14; repository image, production runtime not attested
Syntax
math.cos(x, /)Berekent de cosinus van een hoek in radialen, de horizontale coördinaat op de eenheidscirkel.
Na een halve draai van π is die −1 en bij hoek nul is die 1.
Zet graden eerst om met math.radians.
import math
assert math.isclose(math.cos(math.radians(180)), -1.0)
assert math.cos(0) == 1.0
Voorbeelden
import math
print(round(math.cos(math.pi), 6))
print(math.cos(0))
Resultaat
-1.0 1.0
Zet graden eerst om met math.radians.