# Memory problem for maximizing a multivariable function

I need to maximize the following function. Unfortunately I have to maximize without using numerical methods to prove that the maximal value is 3Sqrt(2Sqrt(3)-3) (about 2.04375). I tried it twice (once with a computer with 8 gm ram (i5 proc.), and with a computer with 16 gm of ram (i7)), but in both cases the memory got full. Is it possible that this can be computed? If so what machine do I need?

v[q_, w_, e_, r_, t_, z_, u_, i_, o_, p_, a_, s_, d_, f_, g_, h_] :=
1/12 (Sqrt[2] Cos[o] Cos[s] Sin[p] +
2 Cos[i] Cos[o] Sin[g] Sin[h] Sin[p] -
2 Cos[o] Cos[s] Sin[g] Sin[h] Sin[p] +
Sqrt[2] Cos[i] Sin[o] Sin[p] - Sqrt[2] Cos[s] Sin[o] Sin[p] +
Sqrt[2] (Cos[u] (Cos[p] - Cos[w]) Sin[i] - Cos[i] Cos[o] Sin[p]) -
Sqrt[2] Cos[e] Cos[s] Sin[r] + Sqrt[2] Cos[e] Cos[w] Sin[r] +
Sqrt[2] Cos[s] Sin[e] Sin[r] - Sqrt[2] Cos[w] Sin[e] Sin[r] +
2 Cos[e] Cos[s] Sin[d] Sin[f] Sin[r] -
2 Cos[e] Cos[z] Sin[d] Sin[f] Sin[r] -
Sqrt[2] Cos[a] Cos[p] Sin[s] + Sqrt[2] Cos[a] Cos[r] Sin[s] +
Sqrt[2] Cos[p] Sin[a] Sin[s] - Sqrt[2] Cos[r] Sin[a] Sin[s] +
2 Cos[a] Cos[h] Sin[d] Sin[f] Sin[s] -
2 Cos[a] Cos[r] Sin[d] Sin[f] Sin[s] -
2 Cos[a] Cos[f] Sin[g] Sin[h] Sin[s] +
2 Cos[a] Cos[p] Sin[g] Sin[h] Sin[s] +
2 Cos[h] Cos[o] Sin[a] Sin[p] Sin[s] -
2 Cos[a] Cos[h] Sin[o] Sin[p] Sin[s] -
2 Cos[e] Cos[f] Sin[a] Sin[r] Sin[s] +
2 Cos[a] Cos[f] Sin[e] Sin[r] Sin[s] -
2 Cos[g] Sin[
h] (-Cos[z] Sin[d] Sin[f] + Cos[i] Sin[o] Sin[p] +
Cos[s] (Sin[d] Sin[f] - Sin[o] Sin[p]) - Cos[f] Sin[a] Sin[s] +
Cos[p] Sin[a] Sin[s] + (-Cos[p] + Cos[z]) Sin[i] Sin[u]) +
Sqrt[2] Cos[i] Cos[q] Sin[w] - Sqrt[2] Cos[q] Cos[r] Sin[w] -
Sqrt[2] Cos[i] Sin[q] Sin[w] + Sqrt[2] Cos[r] Sin[q] Sin[w] -
2 Cos[q] Cos[z] Sin[e] Sin[r] Sin[w] +
2 Cos[e] Cos[z] Sin[q] Sin[r] Sin[w] -
2 Cos[h] Cos[t] Sin[d] Sin[f] Sin[z] +
2 Cos[r] Cos[t] Sin[d] Sin[f] Sin[z] -
2 Cos[f] Cos[t] Sin[e] Sin[r] Sin[z] +
2 Cos[t] Cos[w] Sin[e] Sin[r] Sin[z] +
2 Cos[f] Sin[h] Sin[g - t] Sin[z] -
2 Cos[i] Sin[h] Sin[g - t] Sin[z] +
2 Cos[e] Cos[f] Sin[r] Sin[t] Sin[z] -
2 Cos[e] Cos[w] Sin[r] Sin[t] Sin[z] +
2 Cos[i] Cos[t] Sin[q] Sin[w] Sin[z] -
2 Cos[r] Cos[t] Sin[q] Sin[w] Sin[z] -
2 Cos[i] Cos[q] Sin[t] Sin[w] Sin[z] +
2 Cos[q] Cos[r] Sin[t] Sin[w] Sin[z] +
Sin[i] (2 Cos[h] Sin[p] Sin[o - u] + Sqrt[2] Cos[w] Sin[u] -
Cos[p] (2 Cos[u] Sin[g] Sin[h] + Sqrt[2] Sin[u]) +
2 Cos[z] (Cos[u] Sin[g] Sin[h] - Sin[q - u] Sin[w]) +
2 (-Cos[h] + Cos[w]) Sin[t - u] Sin[z]) +
2 Cos[d] Sin[
f] ((Cos[s] - Cos[z]) (Sin[g] Sin[h] -
Sin[e] Sin[r]) - (Cos[h] - Cos[r]) (Sin[a] Sin[s] -
Sin[t] Sin[z])))
X = Maximize[{v[q, w, e, r, t, z, u, i, o, p, a, s, d, f, g, h],
0 <= q <= 2 Pi, 0 <= e <= 2 Pi, 0 <= t <= 2 Pi, 0 <= u <= 2 Pi,
0 <= o <= 2 Pi, 0 <= a <= 2 Pi, 0 <= d <= 2 Pi, 0 <= g <= 2 Pi,
0 <= w <= Pi, 0 <= r <= Pi, 0 <= z <= Pi, 0 <= i <= Pi,
0 <= p <= Pi, 0 <= s <= Pi, 0 <= f <= Pi, 0 <= h <= Pi}, {q, w, e,
r, t, z, u, i, o, p, a, s, d, f, g, h}]

• Try NMaximize Nov 5, 2020 at 15:44
• I see the following way. First, work with an expression instead of a function: v=1/12 (Sqrt[2] Cos[o] Cos[s] Sin[p] + .... Second, apply TrigExpand@Expand[v]. Third, make a change {Cos[g]->cg,Sin[g]->sg,...} and add the restrictions cg^2+sg^2==1&&...&&sf>=0&& (sf>=0 replaces 0 <= f <= Pi). Therefore, you reduce the transcendental problem under consideration to the polynomial problem with 32 variables. This is still too much for my comp, but yours is more powerful. Good luck! Nov 5, 2020 at 20:35
• This is a great idea! Thanks! Nov 5, 2020 at 22:04
• The function is nonconvex and 16-dimensional. I have high doubts of extracting an exact solution without rewriting the problem to some very different form - or resorting to numerics. Mar 26, 2023 at 0:33

Try NMaximize

X = NMaximize[{v[q, w, e, r, t, z, u, i, o, p, a, s, d, f, g, h],
0 <= q <= 2 Pi, 0 <= e <= 2 Pi, 0 <= t <= 2 Pi, 0 <= u <= 2 Pi,
0 <= o <= 2 Pi, 0 <= a <= 2 Pi, 0 <= d <= 2 Pi, 0 <= g <= 2 Pi,
0 <= w <= Pi, 0 <= r <= Pi, 0 <= z <= Pi, 0 <= i <= Pi,
0 <= p <= Pi, 0 <= s <= Pi, 0 <= f <= Pi, 0 <= h <= Pi}, {q, w, e,
r, t, z, u, i, o, p, a, s, d, f, g, h}]

(*{2.04375, {q -> 1.93316, w -> 1.10085, e -> 0.0556802, r -> 0.266313,
t -> 3.24438, z -> 1.2329, u -> 2.2633, i -> 2.25653, o -> 0.121048,
p -> 2.65805, a -> 5.69525, s -> 1.58568, d -> 4.55036,
f -> 1.12351, g -> 4.20617, h -> 2.27592}}*)

• Thanks for the fast response, I tried and it worked, but unfortunately they do not accept numerical solutions Nov 5, 2020 at 15:49
• Sorry, didn't read your question comletely... Nov 5, 2020 at 16:21