I'm sorry, I wanted to say that the output aren't that I expected. Because for example if I input xs=[1,2], ys=[3,4,5], and d=0.5. The output it's
dist([1,2],[3,4,5],1)
Out[7]: [3, 3]
. However, if the program was well wrote should output [4,5].
I have created this new program
def distance(a,b):
y=sqrt((a.real-b.real)**2+(a.imag-b.imag)**2)
return y
def distancelist(list1,a):
y=[]
for i in range(0,len(list1)):
y=y+[distance(list1[i],a)]
return y
def countthefarpoint(list1,a,dis):
y=distancelist(list1,a)
cont=0
for i in range(0,len(y)-1):
if y[i]>dist:
cont=cont+1
else:
cont=cont
return cont
The program distance(a,b) output the distance between a and b. The program distancelist output a list with the distnace between a and each element of list1, for example for a=2 lis1=[2,3,4,7,-1j] the ouput it's
distancelist([2,3,4,7,-1j],2)
Out[10]: [0.0, 1.0, 2.0, 5.0, 2.2360679774997898]
. And the program countthefarpoint take a list "list" a number "a" and a distance "dist", and output how many times the distance between "a" and each element of "list1" it's bigger than "dist". For a=2 list1=[2,3,4,7,-1j], and dist=2, should output 3, but the output it's
countthefarpoint([2,3,4,7,-1j],2,1)
Out[12]: 0
. I have created the program countthefarpoint, beacause I want to create a program which for two list, lis1 and list2,and a distance dist. Output list1, and the elements of list2 which their distance of each element of list1 be at least dist.