With this:
d1 = 10; d2 = 4;
mat = RandomReal[{-1, 1}, {d1, d2}];
vec = RandomReal[{-1, 1}, d1];
LeastSquares[mat, vec]
returns the x
, that minimizes Plus @@ ((mat.x-vec)^2)
What is the best way to make mathematica return the x
that minimizes Max @@ ((mat.x-vec)^2)
I ended up with this, thank you Daniel ;)
With[{L = Length[First[mat]]},
LinearProgramming[Prepend[ConstantArray[0, L], 1],
Prepend[#, 1] & /@ Riffle[mat, -mat], Riffle[vec, -vec],
Prepend[ConstantArray[-\[Infinity], L], 0]]]
LinearProgramming
directly and avoidNMinimize
overhead. I'd give it an upvote but I notice I already did that. $\endgroup$