DS301222 #didn't get this program

import math
def main():
math.cos(math.pi)
main()
print(main())

pls explain

2 Likes

Hey @vaishu.swap10112016 Import math is a built in module which is used to perform mathematical operations like sin , cos , tan , addition , etc.

So in this code for calculation of cos and pi import math is used

2 Likes
Trigonometric functions Description
math.cos() It returns the cosine of the number (in radians).
math.sin() It returns the sine of the number (in radians).
math.tan() It returns the tangent of the number in radians.
math.acos() It returns the arc cosine of the number in radians.
math.asin() It returns the arc sine of the number in radians.
math.atan() It returns the arc tangent of the number in radians.
import math

print(math.degrees((math.pi/2)))
print(math.radians(60))
import math

print(math.sin(math.pi/3)) #pi/3 radians is converted to 60 degrees
print(math.tan(math.pi/3))
print(math.cos(math.pi/6))
import math

print(math.asin(1))
print(math.acos(0))
print(math.atan(1))
import cmath

x = 1.0
y = 1.0
z = complex(x,y)

print ("The arc sine is: ",cmath.asin(z))
print ("The arc cosine is: ",cmath.acos(z))  
print ("The arc tangent is: ",cmath.atan(z))
import cmath

x = 1.0
y = 1.0
z = complex(x,y)
print ("The hyperbolic sine is : ",cmath.sinh(z))
print ("The hyperbolic cosine is : ",cmath.cosh(z))  
print ("The hyperbolic tangent is : ",cmath.tanh(z))
import cmath

x = 1.0
y = 1.0
z = complex(x,y)

print ("The inverse hyperbolic sine is : ",cmath.asinh(z))
print ("The inverse hyperbolic cosine is : ",cmath.acosh(z))  
print ("The inverse hyperbolic tangent is : ",cmath.atanh(z))
2 Likes

Good one @prabhudevaraj11

ok now i got it… thank u for great explanation

1 Like