0
$\begingroup$

I use Reduce to find conditions on some parameters such that certain inequalities are fulfilled. An additional condition is that all parameters are positive. The first problem is that I have to mention all those conditions when calling Reduce, and the second is that they appear in the result and make it less readable.

I tried to use Assumptions, but it doesn't change the result.

I wonder if it is possible to hide these trivial conditions or at least suppress them in the output?

$Assumptions = Flatten[{Thread[{r, p, h, K} > 0], Element[{r, p, h, K}, Reals]}]
Reduce[K*(r - h)/r > 0 && (p*h)/(r - h) < p && K >0 && p>0 && h>0 && r>0,h]
$\endgroup$
  • 2
    $\begingroup$ MemberQ[Keys[Options[Reduce]], Assumptions] returns False, so it is inappropriate to use $Assumptions with Reduce[]. $\endgroup$ – J. M.'s technical difficulties Jan 22 at 9:23
  • 1
    $\begingroup$ Dmitry, apply Simplify to the result of Reduce. $\endgroup$ – Henrik Schumacher Jan 22 at 9:24
  • $\begingroup$ @HenrikSchumacher, this seems to be the most simple and efficient solution so far. Thank you! $\endgroup$ – Dmitry Jan 22 at 9:38
  • $\begingroup$ You're welcome! $\endgroup$ – Henrik Schumacher Jan 22 at 9:45
1
$\begingroup$

Here is one possibility:

conds = K > 0 && p > 0 && h > 0 && r > 0;
Complement[Reduce[K*(r - h)/r > 0 && (p*h)/(r - h) < p && conds, h, Reals], conds]
   0 < h < r/2
$\endgroup$
  • $\begingroup$ Unfortunately, it does not suppress the conditions from the output when inequalities get more complex, e.g., here: conds = K > 0 && p > 0 && h > 0 && r > 0 && [Rho] > 0; Complement[Reduce[K*(r - h)/r > 0 && (p*h)/(r - [Rho] - h) < p && conds, h, Reals], conds] $\endgroup$ – Dmitry Jan 22 at 9:35
  • 1
    $\begingroup$ Then you can use Simplify[], which does take assumptions: With[{conds = K > 0 && p > 0 && h > 0 && r > 0 && ρ > 0}, Assuming[conds, Simplify[Reduce[K*(r - h)/r > 0 && (p*h)/(r - ρ - h) < p && conds, h, Reals]]]]. $\endgroup$ – J. M.'s technical difficulties Jan 22 at 9:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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