1
$\begingroup$

This question already has an answer here:

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$

marked as duplicate by Michael E2, gwr, m_goldberg, Henrik Schumacher, Bill Watts Jan 17 at 6:07

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    $\begingroup$ Have you seen RandomPoint? $\endgroup$ – Michael E2 Jan 15 at 3:25
  • $\begingroup$ I'm sorry that the question had been asked, I will be more careful next time $\endgroup$ – Facet Jan 15 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

$\endgroup$

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