0

I have the following problem:

I have three lists:

radius=3.0
fcr_size=2.0
x1 = np.arange(0,5.0+0.3,0.3) 
y1 = np.arange(0,5.0+0.3,0.3)
z1 = np.arange(0,5.0+2.0,2.0)

for coords in itertools.product(x1,y1,z1):
        if radius < distance.euclidean([0,0,0],coords) <= (radius+fcr_size):
            xyz_pattern.append(coords)

Why is the output of the float prducts something like this?:

(3.2999999999999998, 2.6999999999999997, 2.0)
(3.2999999999999998, 2.6999999999999997, 4.0)
(3.2999999999999998, 2.6999999999999997, 6.0)
(3.2999999999999998, 3.0, 0.0)
(3.2999999999999998, 3.0, 2.0)
(3.2999999999999998, 3.0, 4.0)
(3.2999999999999998, 3.0, 6.0)
(3.2999999999999998, 3.2999999999999998, 0.0)
(3.2999999999999998, 3.2999999999999998, 2.0)
(3.2999999999999998, 3.2999999999999998, 4.0)
(3.2999999999999998, 3.2999999999999998, 6.0)

Why not something like this:

(3.3, 2.7, 2.0), (3.3, 2.7, 4.0), (3.3, 2.7, 6.0) .....
Varlor
  • 1,421
  • 3
  • 22
  • 46

0 Answers0