# Multiple stopping constraints in NDSolve

I need to numerically solve several differential equations, with several constraints, like this :

Coordinates[s_] := {x[s], y[s], z[s]}

NDSolve[{
x'[s] == F[s],
y'[s] == G[s],
z'[s] == H[s],
x[0] == DataX,
y[0] == DataY,
z[0] == DataZ}, {x, y, z}, {s, 0, 500},
Method -> Automatic, MaxSteps -> Automatic,
StoppingTest -> (
EuclideanDistance[Coordinates[s], Source[1]] < 1 ||
EuclideanDistance[Coordinates[s], Source[2]] < 1 ||
EuclideanDistance[Coordinates[s], Source[3]] < 1 ||
...
EuclideanDistance[Coordinates[s], Source[NumSources]] < 1
)
]


Now, there are NumSources constraints of this type :

    EuclideanDistance[Coordinates[s], Source[k]] < 1


where k = 1, 2, 3, ..., NumSources.

How can I simplify that long part of constraints in the NDSolve defined above ?

This is probably basic, but I don't see how to simplify this.

UPDATE : Just a picture to show off. The magnetic field lines of an arbitrary number of magnetic dipoles (magnetized spheres) :

• Isn't this a duplicate of your previous question, mathematica.stackexchange.com/questions/105869/…? – Michael E2 Feb 9 '16 at 14:46
• It is related to that question, but it isn't the same. Not a duplicate. Or maybe it is ? At first, I made that code just for 2 sources. Now, I want to generalize the code for an arbitrary number of sources. – Cham Feb 9 '16 at 14:49
• The first question was about some aspects for just 2 constraints. Now, I'm trying to generalize the code for an arbitrary number of constraints. Maybe it should be in the same question. – Cham Feb 9 '16 at 14:51
• On a practical note, I don't suppose you can upgrade? My feeling is that the differential equations folks no longer have access to V7, and things have changed so much that no one can test any ideas they might have. – Michael E2 Feb 9 '16 at 14:53
• So can you answer your previous question, then? Your solution might help others suggest one to this question. – Michael E2 Feb 9 '16 at 14:54

StoppingTest ->