Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Select list element around a value

HI

I would like to show all elements of allRootsAPow2 which are around 2 + 3*I this code below does not work ;-(

allRootsAPow2 =[2.00000000000000 + 3.00000000000000*I,
 2.00000000000000 - 3.00000000000000*I,
 -1.05087254532372e-32,
 11.2111025509280 - 6.86482042695334e-16*I,
 2.00000000000000 - 3.00000000000000*I,
 2.00000000000000 + 3.00000000000000*I,
 11.2111025509280 - 6.86482042695334e-16*I,
 -1.05087254532372e-32,
 2.00000000000000 + 3.00000000000000*I,
 2.00000000000000 - 3.00000000000000*I,
 -1.05087254532372e-32,
 11.2111025509280 - 6.86482042695334e-16*I,
 2.00000000000000 - 3.00000000000000*I,
 2.00000000000000 + 3.00000000000000*I,
 11.2111025509280 - 6.86482042695334e-16*I,
 -1.05087254532372e-32,
 -3.21110255092798 + 1.96623323036392e-16*I,
 3.00992653992793e-33,
 2.00000000000000 - 3.00000000000000*I,
 2.00000000000000 + 3.00000000000000*I,
 3.00992653992793e-33,
 -3.21110255092798 + 1.96623323036392e-16*I,
 2.00000000000000 + 3.00000000000000*I,
 2.00000000000000 - 3.00000000000000*I,
 -3.21110255092798 + 1.96623323036392e-16*I,
 3.00992653992793e-33,
 2.00000000000000 - 3.00000000000000*I,
 2.00000000000000 + 3.00000000000000*I,
 3.00992653992793e-33,
 -3.21110255092798 + 1.96623323036392e-16*I,
 2.00000000000000 + 3.00000000000000*I,
 2.00000000000000 - 3.00000000000000*I]

 for el in allRootsAPow2 :
        if (math.ceil(el.real_part()*10)/10)== 2 and (math.ceil(el.imag_part()*10)/10)== 3  :
        #if (math.ceil(el.real_part()*10)/10)== 2  :
        #if (math.ceil(el.imag_part()*10)/10)== 3  :
            show(el)