# How is the "Simplify" command being referenced if I'm not using it directly?

AB = {{9.19, -7.67}, {9.59, -7.32}, {9.81, -7.99}, {12.53, -9.98},
{7.40, -6.26}, {8.03, -6.94}, {9.40, -7.56}, {9.71, -7.63}, {8.15,
-6.89}, {11.57, -9.48}, {11.82, -9.67}, {10.97, -9.15}, {7.57,
-6.20}, {11.50, -8.91}, {8.06, -6.13}, {8.65, -7.17}, {8.39, -7.01},
{14.04, -11.65}, {9.71, -8.14}, {8.19, -6.85}, {7.70, -6.22}, {8.37,
-6.85}, {8.18, -6.41}, {8.81, -7.29}, {10.78, -8.27}, {10.05, -8.79},
{8.00, -6.25}, {7.29, -6.21}, {9.22, -6.95}, {12.49, -9.80}, {8.3,
-6.61}, {7.14, -5.72}, {6.56, -5.27}, {11.54, -9.71}, {10.43, -7.92},
{8.65, -6.95}, {7.54, -6.06}, {7.93, -6.52}, {9.70, -7.80}, {9.86,
-7.73}};

Fin[x_, a_, b_, A_, B_, p_, i_] :=
UnitStep[A^2 B^2 - ((B^2 Cos[p]^2 + A^2 Sin[p]^2) (x[[i, 1]] -
a)^2 + 2 Sin[p] Cos[p] (B^2 - A^2) (x[[i, 1]] - a) (x[[i, 2]] -
b) + (B^2 Sin[p]^2 + A^2 Cos[p]^2) (x[[i, 2]] - b)^2)]

FinTotal[x_, a_, b_, A_, B_, p_] :=
Sum[Fin[x, a, b, A, B, p, i], {i, 1, Length[x]}]

m = -0.8;
p = ArcTan[m];
MinX = Min[AB[[All, 1]]];

{aMin, AMin, BMin} = {a, A, B} /.
NMinimize[{A B,
FinTotal[AB, a, m a, A, B, p] == 0.9 Length[AB] && MinX < a &&
0 < B < A < a/Cos[p] }, {a, A, B}][[2]]


Simplify::time: Time spent on a transformation exceeded 300. seconds, and the transformation was aborted. Increasing the value of TimeConstraint option may improve the result of simplification. >>

• Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! Jan 21, 2016 at 19:50
• You can format inline code and code blocks by selecting the code and clicking the {} button above the edit window. The edit window help button ? is also useful for learning how to format your questions and answers. You may also find this this meta Q&A helpful Jan 21, 2016 at 19:50

Just forbid the symbolic treatment by defining a numerical function:

x = {{9.19, -7.67}, {9.59, -7.32}, {9.81, -7.99}, {12.53, -9.98}, \
{7.40, -6.26}, {8.03, -6.94}, {9.40, -7.56}, {9.71, -7.63}, {8.15, \
-6.89}, {11.57, -9.48}, {11.82, -9.67}, {10.97, -9.15}, {7.57, \
-6.20}, {11.50, -8.91}, {8.06, -6.13}, {8.65, -7.17}, {8.39, -7.01}, \
{14.04, -11.65}, {9.71, -8.14}, {8.19, -6.85}, {7.70, -6.22}, {8.37, \
-6.85}, {8.18, -6.41}, {8.81, -7.29}, {10.78, -8.27}, {10.05, -8.79}, \
{8.00, -6.25}, {7.29, -6.21}, {9.22, -6.95}, {12.49, -9.80}, {8.3, \
-6.61}, {7.14, -5.72}, {6.56, -5.27}, {11.54, -9.71}, {10.43, -7.92}, \
{8.65, -6.95}, {7.54, -6.06}, {7.93, -6.52}, {9.70, -7.80}, {9.86, \
-7.73}};

FinTotNew[a_?NumericQ, b_, A_, B_, p_] :=
Tr[UnitStep[
A^2 B^2 - ((B^2 Cos[p]^2 + A^2 Sin[p]^2) (#[[1]] - a)^2 +
2 Sin[p] Cos[p] (B^2 - A^2)  (#[[1]] - a) (#[[2]] - b) +
(B^2 Sin[p]^2 + A^2 Cos[p]^2) (#[[2]] - b)^2)] & /@ x]

m = -0.8;
p = ArcTan[m]
MinX = Min[x[[All, 1]]]
NMinimize[{A B, FinTotNew[a, m a, A, B, p] == 0.9 Length[x] && MinX < a &&
0 < B < A < a/Cos[p]}, {a, A, B}]

(* {1.6247, {a -> 9.5597, A -> 3.89245, B -> 0.417397}} *)

• Your definition of Fin differs from the one in the question. What is the Tr doing there? Jan 21, 2016 at 20:51
• @SjoerdC.deVries I rearranged the function, but kept the same name. Hope it's clearer now (I only renamed it). Tr replaces the Sum in the old FinTotal Jan 21, 2016 at 20:56
• I had only read your answer up to the _?NumericQ you added and then I started to note some differences. Didn't see you had been combining the two functions. But have you now actually answered the question in the title? Jan 21, 2016 at 21:03
• @SjoerdC.deVries I thought it was clear enough. Added half a line explaining it at the top. "O tempora! O terseness!" Jan 21, 2016 at 21:06
• The point is, the _?NumericQ` trick is usefully the answer to functions complaining about not being able to symbolically user-defined functions (like explained in this answer to our Pitfalls question). That's not the error message here, and the question is not how to get this stuff to run, but to explain the error message. Jan 21, 2016 at 21:09