# Why minimization does not work with symbolic array as arguments

If I try to minimize with constraints a function of several variables, with Gamma regularized function involved in the constraints it seems to works, as shown below (this is just a dummy example problem to try), where S, A , β and m are constants previously declared and assigned a value:

    Minimize[-Log[v] - Log[y] - Log[z],
Gamma[m, S*A*400^β*m*v^(1/m)]/Gamma[m] +
Gamma[m, S*A*400^β*m*z^(1/m)]/Gamma[m] +
Gamma[m, S*A*400^β*m*y^(1/m)]/Gamma[m] <= 1 && v <= 0.1 &&
v >= 0.001 && z <= 0.1 && z >= 0.001 && y <= 0.1 && y >= 0.001, {v,
y, z}]
{6.90776, {v -> 0.1, y -> 0.1, z -> 0.1}}


Now, since I need later to solve a problem with hundreds of variables, I try the same problem with an array of variables, but it does not work:

 Minimize[{\!$$\*UnderoverscriptBox[\(∑$$, $$i = 1$$, $$3$$]$$-Log[h[i]]$$\),
Join[{\!$$\*UnderoverscriptBox[\(∑$$, $$i = 1$$, $$3$$]$$GammaRegularized[ 1, S*A* \*SuperscriptBox[\(400$$, $$β$$]*m*h[i]]\)\) <=
1}, {Table[h[i] <= 0.1, {i, 3}] /.
List -> And} , {Table[h[i] >= 0.001, {i, 3}] /.
List -> And}] /. List -> And}, Table[h[i], {i, 3}]]

Minimize[{-Log[h] - Log[h] - Log[h],
E^(-123.319 h[1.]) + E^(-123.319 h[2.]) + E^(-123.319 h[3.]) <= 1 &&
h <= 0.1 && h <= 0.1 && h <= 0.1 && h >= 0.001 &&
h >= 0.001 && h >= 0.001}, {h, h, h}]


After trying several options, it seems that if I rewrite the problem using only variables h[i], instead of the expression in the argument to the GammarRegularizedfunction it works again (see below):

Minimize[{\!$$\*UnderoverscriptBox[\(∑$$, $$i = 1$$, $$3$$]$$-Log[ \*FractionBox[\(h[i]$$, $$S*A* \*SuperscriptBox[\(400$$, $$β$$]*m\)]]\)\), Join[{\!$$\*UnderoverscriptBox[\(∑$$, $$i = 1$$, $$3$$]$$GammaRegularized[ 1, h[i]]$$\) <=
1}, {Table[h[i] <= S*A*400^β*m*0.1, {i, 3}] /.
List -> And} , {Table[
h[i] >= S*A*400^β*m*0.001, {i, 3}] /. List -> And}] /.
List -> And}, Table[h[i], {i, 3}]]

{6.90776, {h -> 12.3319, h -> 12.3319, h -> 12.3319}}


Why is it that I cannot use a expression as argument? I would need to pass expressions in my real problem as argument.

• What values of S, A , \[Beta] and m are you using? May 7 '15 at 1:35
• (*Parameters*) S = 10^-9.2 cl = 3*10^8 f = 5.9*10^9 w = cl/f A = (4*\[Pi]/w)^(2/1) \[Beta] = 2.5 m = 1
– vega
May 7 '15 at 8:24

Mathematica does not like your h[i]s.

If you introduce

 shrt[head_,
indices_] :=
ToExpression[StringJoin[
ToString /@ Flatten[
indices}]]]


so that e.g. shrt[h,1] becomes h1 or shrt[h,{i,j}] hij

Then this works:

S = 10^-9.2;
cl = 3*10^8 ;
f = 5.9*10^9;
w = cl/f ;
A = (4*π/w)^(2/1);
β = 2.5 ;
m = 1 ;

Join[{Sum[
GammaRegularized[1, S*A*400^β*m*shrt[h, i]] , {i,
3}] <=
1}, {Table[shrt[h, i] <= 0.1, {i, 3}] /.
List -> And} , {Table[shrt[h, i] >= 0.001, {i, 3}] /.
List -> And}] /. List -> And}, Table[shrt[h, i], {i, 3}]]


(* {6.90776,{h1->0.1,h2->0.1,h3->0.1}} *)

• Thanks. From the documentation reference.wolfram.com/language/ref/Array.html I thought you can create an array of variables just doing vars=Array[h,3] but it seems you have to convert them to symbols before somehow. In fact, ToExpression /@vars complains that h is not a string or a box.. I find it odd that you cannot create an array of symbols directly, or can you?
– vega
May 7 '15 at 15:33
• you can do something like ToExpression["h" <> ToString[#]] & /@ Range May 7 '15 at 15:41