This repository demonstrates various mathematical functions available in Python through the math
module. The functions include factorials, radians, trigonometric functions, logarithms, and more.
- Factorial: Calculate the factorial of a number.
- Radians: Convert degrees to radians.
- Trigonometric functions: Sin, Cos, Tan, and more.
- Logarithms and Exponentiation: Compute logarithms and power.
- Time and Mathematical Constants: Work with timestamps, constants like
math.e
andmath.pi
.
print(math.factorial(6)) # 720
print(math.factorial(5)) # 120
print(math.factorial(3)) # 6
print(math.factorial(0)) # 1
print(math.radians(180)) # 3.141592653589793
print(math.acos(0.5)) # 0.6761305095606613
print(math.ldexp(5, 4)) # 80.0
print(math.erfc(1)) # 1.6715105790914593e-07
print(math.fsum([1.1, 2.2])) # 3.3
print(math.comb(14, 2)) # 91
print(math.fmod(10, 3)) # 1.0
print(math.inf) # inf
print(-math.inf) # -inf
print(math.log(23)) # 3.1354942159291497
print(math.tau) # 6.283185307179586
print(time.time()) # Timestamp in seconds
print(time.ctime()) # Human-readable format
print(pow(4, 3)) # 64
print(math.fabs(-13.4)) # 13.4
print(math.isfinite(100)) # True
print(math.isinf(math.inf)) # True
print(math.floor(11.7)) # 11
print(math.floor(-11.7)) # -12
print(math.asin(1)) # 1.5707963267948966
print(math.copysign(24, -35)) # -24.0
print(math.sin(math.pi / 4)) # 0.7071067811865476
print(math.cos(math.pi / 4)) # 0.7071067811865476
print(math.tan(math.pi / 4)) # 0.9999999999999999
print(math.e) # 2.718281828459045
print(math.ceil(2.3)) # 3
print(math.floor(2.3)) # 2
print(min(5, 25)) # 5
print(max(5, 25)) # 25
print(round(5.6)) # 6
print(round(5.4)) # 5