Message Boards Message Boards

0
|
2764 Views
|
5 Replies
|
6 Total Likes
View groups...
Share
Share this post:

How to build a set or a region by linear inequalities?

Posted 2 years ago

Hi everyone, I have a question on build a set or a region in high-dimension space. I want to build the set constrained by a series of linear inequalities such as {x|Ax<=b}. However, I only found the function like ConvexHullMesh that needs to be defined by vertices.

But I aim to build a convex polyhedral cone being defined as {x|Ax<=0}, which has no vertex but the 0 point. How should I do this. Many thanks.

POSTED BY: Zhenzhong Gao
5 Replies

Here is an example with 6 inequalities describing fractional matchings in a triangle graph. You can use it with general inequalities (not necessarily linear).

RegionPlot3D[{x + y <= 1 && x + z <= 1 && y + z <= 1 && x >= 0 && 
   y >= 0 && z >= 0}, {x, 0, 1}, {y, 0, 1}, {z, 0, 1}]

Good luck.

POSTED BY: Elad Shufan

It depends on what you are going to do with it. ImplicitRegion, RegionPlot and RegionPlot3D let you specify a region by inequalities:

reg = ImplicitRegion[x <= 0 && x + y <= 0, {x, y}]
RegionPlot[reg]
RegionPlot3D[x <= 0 && x + y <= 0 && x + y + z <= 0,
 {x, -1, 1}, {y, -1, 1}, {z, -1, 1},
 AxesLabel -> Automatic]
POSTED BY: Gianluca Gorni
Posted 2 years ago

Thanks a lot. Since I wanna write the condition in calculation of matrices instead of separating them, would you please show me how to do it. I tried the following code but it does not work,

reg=ImplicitRegion[A.{x1,x2}<=b, {x1,x2}]

Could you please show me why?

POSTED BY: Zhenzhong Gao

Here is a way:

myMatrix = RandomInteger[{-3, 3}, {4, 4}];
reg = ImplicitRegion[
  And @@ Thread[myMatrix . {x1, x2, x3, x4} <= 0], {x1, x2, x3, x4}]
pt = {x1, x2, x3, x4} /. 
  First@FindInstance[
    And @@ Thread[myMatrix . {x1, x2, x3, x4} <= 0] && x1 < 0, {x1, 
     x2, x3, x4}]
RegionMember[reg, pt]
POSTED BY: Gianluca Gorni
Posted 2 years ago

Thank you very much. The ImplicitRegion function should be a good choice.

I am sorry that I am only a green hand to Mathematica so I need more time to understand your codes. Thanks again for your kind help.

POSTED BY: Zhenzhong Gao
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract