-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmathbuilt.py
51 lines (41 loc) · 1.07 KB
/
mathbuilt.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import math
# 1. Absolute value
abs_value = abs(-10)
print("Absolute value:", abs_value)
# 2. Square root
sqrt_value = math.sqrt(25)
print("Square root:", sqrt_value)
# 3. Exponential
exp_value = math.exp(2)
print("Exponential:", exp_value)
# 4. Logarithm
log_value = math.log(10)
print("Logarithm:", log_value)
# 5. Trigonometric functions
sin_value = math.sin(math.pi/2)
cos_value = math.cos(math.pi)
tan_value = math.tan(math.pi/4)
print("Sine:", sin_value)
print("Cosine:", cos_value)
print("Tangent:", tan_value)
# 6. Ceiling and floor
ceil_value = math.ceil(4.3)
floor_value = math.floor(4.7)
print("Ceiling:", ceil_value)
print("Floor:", floor_value)
# 7. Power
power_value = math.pow(2, 3)
print("Power:", power_value)
# 8. Maximum and minimum
max_value = max(5, 10, 3)
min_value = min(5, 10, 3)
print("Maximum:", max_value)
print("Minimum:", min_value)
# 9. Rounding
round_value = round(3.7)
print("Rounded value:", round_value)
# 10. Constants
pi_value = math.pi
e_value = math.e
print("Pi:", pi_value)
print("E:", e_value)