# Minimization with constraint define over a region

I would like to perform a 2D electrostatic minimization between two charged ellipsoids, provided that they should not penetrate each other; they can touch but they are hard ellipsoids. Here is what I have done, but I get some error-warning messages.

U is the electrostatic potential and by defining Δ and δ, I defined the relative displacement of the ellipsoids relative to each other in x and y directions. One ellipsoid is fixed at the origin. Then I defined two regions ℛ1 and ℛ2 where the distance between them should be positive to prevent them penetrating each other.

Did I make mistake when passing the values of these relative displacements, Δ and δ , to the Ellipsoid function?

R1 = 4.15;
ρ = 3.3;
R = R1 ρ^(-(1/3));
e1 = Sqrt[1 - 1/ρ^2];
Eex = 100;
p = Sqrt[Eex*0.385177788];
d = R Sqrt[3/5 (ρ^2 - 1)];
q = p/(2 d);
ϵ = 1;
pre = q^2/(4 π ϵ);
r1 = Sqrt[Δ^2 + (2 d + δ)^2];
r2 = Sqrt[Δ^2 + δ^2];
r3 = Sqrt[Δ^2 + (4 d + δ)^2];

U = pre (2/r1 - 1/r2 - 1/r3);
ℛ1 = Ellipsoid[{0, 0}, {R, ρ*R}];
ℛ2 = Ellipsoid[{Δ, 2 d + δ}, {R, ρ*R}];

FindMinimum[{U && MinValue[EuclideanDistance[x, y], {x ∈ ℛ1, y ∈ ℛ2}] > 0}, {Δ, δ}]

• Changing the argument of FindMinimum to a list, rather than a logical combination, and substituting NMinValue for MinValue will at least give you a result, but after many warnings: FindMinimum[{U, NMinValue[EuclideanDistance[x, y], {x ∈ ℛ1, y ∈ ℛ2}] > 0}, {Δ, δ}]. I think the NMinValue is struggling mightily here. – MarcoB Mar 14 '16 at 16:40
• @MarcoB, Thank you so much for your help and recommendation. I have changed it, but unfortunately the result is not correct. I am a little confused that the problem caused by bad parameters in this term 'ℛ2 = Ellipsoid[{Δ, 2 d + δ}, {R, ρ*R}];' as 'Δ' and 'δ' both are used for minimization of the electrostatic potential. I do not understand what Mathematica does for the initial guess of those parameters which directly affects the location of the second ellipsoid. – O_o Mar 14 '16 at 19:34