Sorry if this is a newbie question. I wrote a function to decide if a given vector is in the convex hull of another set of vectors using linear programming.
τ[dim_] := NMaximize[(dim - 2) Sin[s] + Sin[2 s], s][[1]]
τ[dim_, j_] := j NMaximize[(dim - 2 j) Sin[s] + j Sin[2 s], s][[1]]
BinaryCube[w_, bits_] := Table[(-1)^(BitAnd[w, 2^j]/2^j), {j, bits - 1, 0, -1}]
Proj[w_] := w - Sum[w[[i]], {i, 1, Dimensions[w][[1]]}]/Dimensions[w][[1]];
DB[dim_] := dim/2 Table[Proj[BinaryCube[w, dim]], {w, 1, 2^dim - 2}]
ConvexHull[M_, b_] :=
If[Table[1, {j, 1, Dimensions[M][[2]]}] .
LinearProgramming[Table[1, {j, 1, Dimensions[M][[2]]}], M, b] < 1,
1, 0]
DBMatrix = Transpose[DB[3]]
RegionPlot[
ConvexHull[DBMatrix, α {1, -1, 0}/Sqrt[2] + β {1, 1, -2}/Sqrt[6]] > 1/2,
{α, -3, 3}, {β, -3, 3},
PlotStyle -> Red]
When I call the function with a fixed matrix (representing the vectors defining the vertices of the convex polytope) and vector that we are checking for membership in the convex region it runs fine but when I call it from RegionPlot
it generates a warning.
LinearProgramming::lpnn: Input data to linear programming algorithm {{1,1,1,1,1,1},{{1,1,2,-2,-1,-1},{1,-2,-1,1,2,-1},{-2,1,-1,1,-1,2}},{α/Sqrt[2]+β/Sqrt[6],-(α/Sqrt[2])+β/Sqrt[6],-Sqrt[(2/3)] β},{{}},{}} contains elements that are empty matrices, invalid vectors or matrices, or not real numbers.
Anyone know what is going on here? I am not sure where these empty vectors are coming from. For what it is worth it still generates what I know to be the correct plot in this case.