# Remember to import math in order to use its functions import math # Demonstrating sin() and cos() on a value close to pi/4 a = 3.1415 / 4 print("sin of 3.1415 / 4 is:", math.sin(a)) print("cos of 3.1415 / 4 is::", math.cos(a)) # Now we do the same but with the constant math.pi from the math module a = math.pi / 4 print("The value of pi/4 is:", a) print("sin of math.pi/4 is:", math.sin(a)) print("cos of math.pi/4 is::", math.cos(a)) # Demonstrating degrees() and radians() angle_in_radians = math.pi / 2 # 90 degrees in radians angle_in_degrees = math.degrees(angle_in_radians) print("90 degrees in radians is:", angle_in_radians, "radians") print("Converted back to degrees:", angle_in_degrees, "degrees") # Demonstrating sqrt() num = 16 square_root = math.sqrt(num) print("The square root of", num, "is:", square_root) # Demonstrating exp() (exponential) power = 3 exp_value = math.exp(power) # e^3 print("The value of e^", power, "is:", exp_value) # Demonstrating log() num = 10 log_value = math.log(num) # natural logarithm (log base e) log10_value = math.log10(num) # logarithm base 10 print("The natural log of", num, "is:", log_value) print("The log base 10 of", num, "is:", log10_value) # Demonstrating ceil() and floor() num = 3.7 ceiling_value = math.ceil(num) floor_value = math.floor(num) print("The ceiling of", num, "is:", ceiling_value) print("The floor of", num, "is:", floor_value) # Demonstrating pow() (power) base = 2 exponent = 3 power_result = math.pow(base, exponent) # This is the same as 2**3 print(base, "raised to the power of", exponent, "is:", power_result)