I'm trying to plot the feasible region of a maximization problem with PlotRegion3D
. This region is the intersection of two constraints and I'd like to plot also the line that goes through the points in which both constraints are satisfied as equalities. My end goal is to have this feasible region embedded in a Manipulate
environment and, therefore, my current approach of computing the line manually is not adequate.
My code is
ClearAll["Global`*"]
X = {{1, 4}, {2, 4}, {4, 4}};
qVec = Array[q, 3];
kVec = {10, 15};
a = 1/2;
needs = Transpose[X].qVec^(1/a);
max = Table[(Min[kVec[[1]]/X[[i, 1]],kVec[[2]]/X[[i, 2]]])^a,{i, 1, 3}];
r1 = RegionPlot3D[needs[[1]] <= kVec[[1]] && needs[[2]] <= kVec[[2]], {q[1], 0,
max[[1]]}, {q[2], 0, max[[2]]}, {q[3], 0, max[[3]]}, Mesh -> None];
inter = ParametricPlot3D[{(2 z^2 - 5/2)^a, (25/4 - 3 z^2)^a,z}, {z, Sqrt[5/4], Sqrt[25/12]}];
Show[{r1, inter}]
Ideally, I'd use the output of Solve[Flatten[{needs == kVec, Thread[qVec >= 0]}], qVec, Reals]
in the ParametricPlot3D
.
Also, feel free to suggest improvements in the code.