3.2. Built-ins

3.2.1. Constants

3.2.1.1. Pi number

import numpy as np


np.pi
# 3.1415926535897931

3.2.1.2. Euler number

import numpy as np


np.e
# 2.7182818284590451

3.2.1.3. Not-a-Number

  • Special float value

  • Propagates in calculations

import numpy as np


np.nan
# nan
import numpy as np


np.nan + 1          # nan
np.nan + np.nan     # nan
np.nan - np.nan     # nan
np.nan - np.inf     # nan

np.nan / np.nan     # nan
0 / np.nan          # nan
np.nan / 0          # ZeroDivisionError: float division by zero

3.2.1.4. Infinity

import numpy as np


np.inf
# inf
import numpy as np


np.inf + 1          # inf
np.inf + np.inf     # inf
np.inf - np.inf     # nan
np.inf - np.nan     # nan

np.inf * np.inf     # inf
np.inf / np.inf     # nan

0 / np.inf          # 0.0
np.inf / 0          # ZeroDivisionError: float division by zero

3.2.2. Assignments

Todo

Create assignments