Hi Jose, thank you again for your response!
I will try to explain myself better. Having a list of cities and their populations, I have gotten a matrix of distances between them:
cities = Entity["City", #] & /@ {{"Istanbul", "Istanbul",
"Turkey"}, {"Moscow", "Moscow", "Russia"}, {"London",
"GreaterLondon", "UnitedKingdom"}, {"Berlin", "Berlin",
"Germany"}, {"Madrid", "Madrid", "Spain"}};
populations = QuantityMagnitude@EntityValue[cities, "Population"];
R = QuantityMagnitude@Table[GeoDistance[cities[[i]], cities[[j]]], {i, 1,
Length[cities]}, {j, 1, Length[cities]}];
What I want is to obtain a second matrix, where every element is given by the population contained within a circle, defined by center in city i
, and radius R[[i,j]]
, excluding the populations of cities i
and j
. This is my own attempt, based on previous replies:
S = Table[Table[Boole[0 < R[[i, k]] < R[[i, j]]], {k, 1, 5}] .
populations, {i, 1, 5}, {j, 1, 5}]
It may not be the most efficient solution, but it seems to work, at least for small cases.
Any additional ideas would be much appreciated!
Thanks.