Ask Your Question

Revision history [back]

min-max-ing a function with sage

Suppose S is a family of k matrices. Then, given formal variables x[0], ... , x[k], consider the expression min(x[0] * S[0] + ... + x[k-1]*S[k-1]). I want to maximize the value of this expression with respect to the constraints x[0],...x[k] >= 0 and x[0] + ... + x[k] = 1.

This is the corresponding mathematica code:

\[Beta][T_] := 
With[{vars = Array[x, Length[T]]},
Maximize[{Min[Total[MapThread[Times, {vars, T}]]], (And @@ Thread[vars >=0])&& Total[vars] == 1},vars]
]

How can I define this in sage?

I have thought of using sage.numerical.optimize.minimize_constrained but I do not particularly like it because it (unlike mathematica) seems to give inexact values.