1
$\begingroup$

enter image description here

I want to take some points randomly by the limits above, I had try to use FindInstance method but it always out (0,0) FindInstance[9 x + 7 y <= 56 && 7 x + 20 y <= 70, {x, y}, RandomSeeding -> Automatic]

$\endgroup$
  • 2
    $\begingroup$ Have you seen RandomPoint? $\endgroup$ – Michael E2 Jan 15 '19 at 3:25
  • $\begingroup$ I'm sorry that the question had been asked, I will be more careful next time $\endgroup$ – Facet Jan 15 '19 at 4:35
4
$\begingroup$

You can use ImplicitRegion and RandomPoint:

SeedRandom[1]
RandomPoint[ImplicitRegion[9 x + 7 y <= 56 && 7 x + 20 y <= 70,
   {{x, 5, Infinity}, {y, 0, Infinity}}], 10]

{{5.99903,0.202433},{5.13618,0.481529},{5.22954,0.613772},{5.08035,0.511267},{5.28252,0.815217},{5.48401,0.265592},{5.91503,0.0185986},{5.51682,0.497948},{6.19432,0.0188226},{5.25428,1.24232}}

Alternatively,

SeedRandom[1]
RandomPoint[ImplicitRegion[9 x + 7 y <= 56 && 7 x + 20 y <= 70 && x > 5 && y >= 0,
  {x, y}], 10]

same result

| improve this answer | |
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.