In [1]:
import math
In [2]:
print(math.e)
In [3]:
print(2**4)
In [4]:
print(pow(2, 4))
In [5]:
print(math.pow(2, 4))
In [6]:
print(pow(1 + 1j, 2))
In [7]:
# print(math.pow(1 + 1j, 2))
# TypeError: can't convert complex to float
In [8]:
print(pow(2, 4, 5))
In [9]:
print(2**0.5)
In [10]:
print(math.sqrt(2))
In [11]:
print(2**0.5 == math.sqrt(2))
In [12]:
print((-3 + 4j)**0.5)
In [13]:
# print(math.sqrt(-3 + 4j))
# TypeError: can't convert complex to float
In [14]:
print((-1)**0.5)
In [15]:
# print(math.sqrt(-1))
# ValueError: math domain error
In [16]:
import cmath
print(cmath.sqrt(-3 + 4j))
In [17]:
print(cmath.sqrt(-1))
In [18]:
print(math.exp(2))
In [19]:
print(math.exp(2) == math.e**2)
In [20]:
print(math.log(25, 5))
In [21]:
print(math.log(math.e))
In [22]:
print(math.log10(100000))
In [23]:
print(math.log2(1024))