Home >>Python math Module >Python math.cos() Method

Python math.cos() Method

Python math.cos() Method

Python math.cos() Method in python is used to returns the cosine of the given number radians and it accepts a number.

Syntax:
math.cos(x)

Parameter Values

Parameter Description
x It is required a number to find the cosine, and it returns a TypeError
Here is an example of Python math.cos() Method:

import math
print (math.cos(0.02))
print (math.cos(-1.67))
print (math.cos(4))
print (math.cos(6.873435))

Output:
0.9998000066665778
-0.09904103659872801
-0.6536436208636119
0.8308017338455046
Example 2:

import math
x = -4
print("cos(",x,") is = ", math.cos(x))
x = 2
print("cos(",x,") is = ", math.cos(x))
x = -1.562
print("cos(",x,") is = ", math.cos(x))
x = -2
print("cos(",x,") is = ", math.cos(x))

Output:
cos( -4 ) is = -0.6536436208636119
cos( 2 ) is = -0.4161468365471424
cos( -1.562 ) is = 0.0087962133588359
cos( -2 ) is = -0.4161468365471424

No Sidebar ads