# Math function in Python • Python contains the following math functions.
• It is used to get sine of any number in radians.
``````
import math
x=math.sin(2)
print("Result:",x)
"""
***Output***
Result: 0.9092974268256817
"""
``````
• It is used to get cosine of any number in radians.
``````
import math
x=math.cos(2)
print("Result:",x)
"""
***Output***
Result: -0.4161468365471424
"""
``````
• It is used to get tangent of any number in radians.
``````
import math
x=math.tan(2)
print("Result:",x)
"""
***Output***
Result: -2.185039863261519
"""
``````
• It returns the square root of any number.
``````
import math
x=math.sqrt(16)
print("Result:",x)
y=math.sqrt(14)
print("Result:",y)
"""
***Output***
Result: 4.0
Result: 3.7416573867739413
"""
``````
• It returns the base-10 logarithm of any number.
``````
import math
x=math.log10(10)
print("Result:",x)
y=math.log10(5)
print("Result:",y)
"""
***Output***
Result: 1.0
Result: 0.6989700043360189
"""
``````
• It is used to the power of any number.
• if pow(a,b) then it returns a raised to the power b.
``````
import math
x=math.pow(2,3)
print("Result:",x)
y=math.pow(5,2)
print("Result:",y)
"""
***Output***
Result: 8.0
Result: 25.0
"""
``````
• It returns the factorial of any number.
``````
import math
x=math.factorial(5)
print("Factorial of 5:",x)
y=math.factorial(4)
print("Factorial of 4:",y)
"""
***Output***
Factorial of 5: 120
Factorial of 4: 24
"""
``````
• It returns the exponential of any number.
``````
import math
x=math.exp(0)
print("exp(0):",x)
y=math.exp(4)
print("exp(4):",y)
"""
***Output***
exp(0): 1.0
exp(4): 54.598150033144236
"""
``````
• It returns the largest integer less than or equal to given number.
``````
import math
print(math.floor(3.2))
print(math.floor(3.5))
print(math.floor(3.9))
"""
***Output***
3
3
3
"""
``````
• It returns the smallest integer greater than or equal to given number.
``````
import math
print(math.ceil(3.2))
print(math.ceil(3.5))
print(math.ceil(3.9))
"""
***Output***
4
4
4
"""
``````
Request:-If you found this post helpful then let me know by your comment and share it with your friend.
If you want to ask a question or want to suggest then type your question or suggestion in comment box so that we could do something new for you all.

If you have not subscribed my website then please subscribe my website.

Try to learn something new and teach something new to other. Thanks.