Cos function - python math module

Method name:

cos(aRadians_in)

Method overview:

The python, math.cos() function returns the ratio of adjacent side 
to the hypotenuse, for the given radian value.

Parameters:

aRadians_in : Radians for which the cosine θ value needs to be found.

Return value:

The cosine θ value for the given radians value is returned.

Example:

# Find cos θ value for common angles

import math

 

# cos θ value for zero degrees

Radians0    = math.radians(0)

cos0        = math.cos(Radians0)

cos0Rounded = round(cos0,2)

 

# cos 30 value for zero degrees

Radians30           = math.radians(30)

cos30               = math.cos(Radians30)

cos30Rounded        = round(cos30,2)

 

# cos 45 value for zero degrees

Radians45       = math.radians(45)

cos45           = math.cos(Radians45)

cos45Rounded    = round(cos45,2)

 

# cos 60 value for zero degrees

Radians60           = math.radians(60)

cos60               = math.cos(Radians60)

cos60Rounded        = round(cos60,2)

 

# cos 90 value for zero degrees

Radians90       = math.radians(90)

cos90           = math.cos(Radians90)

cos90Rounded    = round(cos90,2)

 

# math.cos(radians) : Python Example: Printing cosine values for common angles

print("cos 0:{}".format(cos0Rounded))

print("cos 30:{}".format(cos30Rounded))

print("cos 45:{}".format(cos45Rounded))

print("cos 60:{}".format(cos60Rounded))

print("cos 90:{}".format(cos90Rounded))

 

Output:

cos 0:1.0

cos 30:0.87

cos 45:0.71

cos 60:0.5

cos 90:0.0


Copyright 2024 © pythontic.com