If I run the following code it does not recognize several of the numbers in the array, like 0.1
, even though it looks like 0.1
is in the array when it is printed.
import numpy as np
pH = 0.1
print(np.linspace(0.0, 2.9, num=30))
if pH in np.linspace(0.0, 2.9, num=30):
print("it doesn't recognize 0.1")
pH = 0.3
if pH in np.linspace(0.0, 2.9, num=30):
print('however it does recognize 0.3')
Output:
[0. 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1. 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2. 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9]
however, it does recognize 0.3