0
$\begingroup$

Please consider FindInstance[m >= 0 && x >= 0 && x <= m, {x}] for which, I would like a parametric answer x = m or x=m/2. But this yields an error: FindInstance: The system contains a nonconstant expression m independent of variables {x}. How can I achieve this goal?

$\endgroup$
1
  • 1
    $\begingroup$ Perhaps Reduce is what you need? $\endgroup$
    – Johu
    Commented Sep 5, 2018 at 13:42

1 Answer 1

1
$\begingroup$

FindInstance wants to have all the variables listed expicitly. So you can do:

FindInstance[m >= 0 && x >= 0 && x <= m, {x, m}]

To see many answers:

FindInstance[m >= 0 && x >= 0 && x <= m, {x, m}, 5]

If you want a specific answer (like x==m/2), then you'll need to say that you want that form

FindInstance[m >= 0 && x >= 0 && x <= m && x == m/2, {x, m}, 5]

Thus FindInstance finds a numerical example, not a symbolic one. If you want to keep things symbolic, perhaps you can use Reduce or Solve, for example

Reduce[m >= 0 && x >= 0 && x <= m && x == m/2] 

reduces to a smaller number of statements (two) that is equivalent to the four conditions input.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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