6
$\begingroup$

I've got an inequality of 10 non-negative parameters (arising from a 5x5 matrix) and would like to verify whether it holds. I tried the following, which doesn't seem to work:

con = Thread[ {(k + μ)*(γ1 + μ) - β1 *Ν*k*(1 - q)*(γ2 + μ) > 
     0 }, {0 <= {k, μ, γ1, γ2, β1, β2, q} <= 1}, {Ν = 2000}];
Simplify[Reduce[
  Flatten[{[(γ2 + μ) - 
        Ν*k (β1*(1 - q) + β2 *q)] - [(k + μ)*(γ1 + μ) - 
        β1 *Ν*k*(1 - q)*(γ2 + μ)] > 0, con}], {k, μ, γ1, γ2, β1, β2, 
   Ν, q}], con]

Does anyone know what is the expression in Mathematica for this? Thank you.

$\endgroup$
4
  • $\begingroup$ Your con is a bit broken. Do you mean con = With[{Ν = 2000}, And[(k + μ)*(γ1 + μ) - β1*Ν*k*(1 - q)*(γ2 + μ) > 0, And @@ (0 <= # <= 1 & /@ {κ, μ, γ1, γ2, β1, β2, κ, q})]] $\endgroup$
    – flinty
    Commented Jul 6, 2020 at 17:35
  • $\begingroup$ You've also got brackets [ ] in your Reduce where there shouldn't be any. Do you mean ( ) ? $\endgroup$
    – flinty
    Commented Jul 6, 2020 at 17:38
  • $\begingroup$ I think I've fixed things up, please tell me if this is the equivalent problem: pastebin.com/8mw4RN3E $\endgroup$
    – flinty
    Commented Jul 6, 2020 at 17:46
  • $\begingroup$ Thank you for your help. I tried it but it keeps on running without giving any result. $\endgroup$
    – Vicky
    Commented Jul 6, 2020 at 18:30

3 Answers 3

4
$\begingroup$

Though solutions exist, as shown by the other answers, the inequality does not hold under the constraints in general. With N=2000 and all variables zero except $\mu=1$ we can satisfy the constraint, but not the inequality.

Ν = 2000;

vars = {k, μ, γ1, γ2, β1, β2, κ, q};
con = ((k + μ)*(γ1 + μ) - β1*Ν*k*(1 - q)*(γ2 + μ) > 0);
ineq = (((γ2+μ) - Ν*κ (β1*(1-q) + β2*q)) - ((k+μ)*(γ1+μ) - β1*Ν*k*(1-q)*(γ2+μ)) > 0);

Resolve[
  ForAll[{k, μ, γ1, γ2, β1, β2, κ, q},
  (And @@ (0 <= # <= 1 & /@ vars)),
  Implies[con, ineq]], Reals]

sol = First@
  FindInstance[
   con && (And @@ (0 <= # <= 1 & /@ vars)) && Not[ineq],
   {k, μ, γ1, γ2, β1, β2, κ, q}, Reals]

(* {k -> 0, μ -> 1, γ1 -> 0, γ2 -> 0, β1 -> 0, β2 -> 0, κ -> 0, q -> 0} *)

con /. sol (* True *)
ineq /. sol (* False *)

Update 1: After the edits to the question and comments suggesting a different variable range, it's still the case that it does not hold in general and there are solutions which pass the constraints but fail the inequality:

Ν = 2000;
vars = {k, μ, γ1, γ2, β1, β2, q};
con = ((k + μ)*(γ1 + μ) - β1*Ν*k*(1 - q)*(γ2 + μ) > 0);
ineq = ((γ2 + μ) - Ν*k (β1*(1 - q) + β2*q)) - 
  ((k + μ)*(γ1 + μ) - β1*Ν*k*(1 - q)*(γ2 + μ)) > 0;
ranges = (0 < k < 1) && (0 < q < 1) && (And @@ (0 < # & /@ {μ, γ1, γ2, β1, β2}));

sol = First@FindInstance[con && ranges && Not[ineq], vars, Reals]
(* {k -> 1/2048, μ -> 1, γ1 -> 1, γ2 -> 1, β1 -> 1, β2 -> 1, q -> 1/2} *)
con /. sol (* True *)
ineq /. sol (* False *)
$\endgroup$
3
  • $\begingroup$ Thank you very much for your help. The above code seems to work, however there are some parts I'm not sure what you're doing. For instance, the 'Not[ineq]'. May I ask you what does the 'Not' stand for? Also I tried with a simpler case, e.g. γ1+γ2+μ>0 when γ1+γ2>0, but I get again the same True-False result. $\endgroup$
    – Vicky
    Commented Jul 7, 2020 at 10:25
  • $\begingroup$ I corrected also the κ-k typo in my comment, apologies for the mistake. At this stage I'm interested in making the code work, as I have a couple of inequalities to check much more complicated than this one. May I ask how this would work if we choose: 0 < {k,q}<1 and 0 <{μ, γ1, γ2, β1, β2}, instead? $\endgroup$
    – Vicky
    Commented Jul 7, 2020 at 10:32
  • $\begingroup$ The Not part is because I'm trying to check if there is an instance which satisfies the constraint but NOT the inequality. With your update, this is still the case and I've tried 0<# for k,q and anything positive for the others. It still passes the constraint with {k -> 1/2048, μ -> 1, γ1 -> 1, γ2 -> 1, β1 -> 1, β2 -> 1, q -> 1/2} but fails the inequality. $\endgroup$
    – flinty
    Commented Jul 7, 2020 at 11:51
4
$\begingroup$

Making use of the valuable comments by flinty, I obtain

n = 2000; con = (k + μ)*(γ1 + μ) - β1*n*
 k*(1 - q)*(γ2 + μ) > 0 && k >= 0 &&  k <= 1 &&
 μ >= 0 && μ <= 1 && β1 >= 0 && β1 <= 1 &&  
γ1 >= 0 && γ1 <= 1 && q >= 0 && 
  q <= 1 && γ2 >= 0 && γ2 <= 1;
Flatten[{((γ2 + μ) - 
   n*κ *(β1*(1 - q) + β2*
       q)) - ((k + μ)*(γ1 + μ) - β1*n*
    k*(1 - q)*(γ2 + μ)) > 0, con}]; 

FindInstance[%, {κ, μ, γ1, γ2, β1, β2, k, q}]
(*{{κ -> 0, μ -> 1/2, γ1 -> 0, γ2 ->  0, β1 -> 0, β2 -> 0, k -> 0, q -> 0}}*)

Therefore, the inequality under consideration has a solution.

$\endgroup$
5
  • $\begingroup$ Thank you for your reply. I'm running your code and getting "FindInstance: The system contains a nonconstant expression Ν independent of variables {κ,μ,γ1,γ2,β1,β2,k,q}." $\endgroup$
    – Vicky
    Commented Jul 7, 2020 at 10:44
  • 1
    $\begingroup$ @Vicky: Works for me after my edit. $\endgroup$
    – user64494
    Commented Jul 7, 2020 at 18:58
  • $\begingroup$ @Vicky could you clarify in your question whether you want it to hold in general, or if you want a specific solution. $\endgroup$
    – flinty
    Commented Jul 7, 2020 at 19:18
  • $\begingroup$ Thank you for your reply. I still get the same message though. I want it to hold in general. I've got a couple of more complicated inequalities and I want to know if they are true or false for the range of parameters (which should eventual be 0 < {k,q}<1 and 0 <{μ, γ1, γ2, β1, β2}). Ideally, I want to get the conditions for which the inequality holds, not a set of specific parameters, as it is part of a proof, but at least getting from Mathematica that the inequalities hold is helpful. $\endgroup$
    – Vicky
    Commented Jul 7, 2020 at 22:14
  • $\begingroup$ @Ordinary users68 and anyone else: Please, don't edit my answer. $\endgroup$
    – user64494
    Commented Jul 8, 2020 at 8:14
1
$\begingroup$
Clear["Global`*"]

You cannot use square brackets as if they were parentheses. You cannot use Set rather than Equal in a condition/assumption.

In the constraints for 0 <= vars <= 1 you included κ twice and did not include k. I will assume that the second κ was intended to be k

con = Flatten[
   {(k + μ)*(γ1 + μ) - β1*Ν*k*(1 - q)*(γ2 + μ) > 0, 
    Thread[0 <= {κ, μ, γ1, γ2, β1, β2, k, q} <= 1], 
        Ν == 2000}];

sys = {((γ2 + μ) - Ν*κ (β1*(1 - q) + β2*q)) - 
            ((k + μ)*(γ1 + μ) - β1*Ν*
         k*(1 - q)*(γ2 + μ)) > 0, con} // Flatten;

vars = Variables[Level[sys, {-1}]]

(* {k, q, β1, β2, γ1, γ2, κ, μ, Ν} *)

ineq = Assuming[con, 
  ((γ2 + μ) - Ν*κ (β1*(1 - q) + β2*q)) - 
     ((k + μ)*(γ1 + μ) - β1*Ν*k*(1 - q)*(γ2 + μ)) > 0 // 
  Refine // FullSimplify]

(* γ2 + 
  2000 ((-1 + q) β1 - 
     q β2) κ + μ > (k + μ) (γ1 + μ) + 
  2000 k (-1 + q) β1 (γ2 + μ) *)

sys2 = {ineq, con} // Flatten;

FindInstance returns an instance immediately.

FindInstance[sys, vars]

(* {{k -> 1/2, 
  q -> 0, β1 -> 0, β2 -> 0, γ1 -> 1, γ2 -> 
   1, κ -> 0, μ -> 0, Ν -> 2000}} *)

or

FindInstance[sys2, vars]

(* {{k -> 1/2, 
  q -> 0, β1 -> 0, β2 -> 0, γ1 -> 1, γ2 -> 
   1, κ -> 0, μ -> 0, Ν -> 2000}} *)

However, it cannot readily come up with a second instance.

TimeConstrained[FindInstance[sys, vars, 2], 60]

(* $Aborted *)

or

TimeConstrained[FindInstance[sys2, vars, 2], 60]

(* $Aborted *)

Consequently, it is extremely unlikely that the inequality generally holds.

$\endgroup$
2
  • 1
    $\begingroup$ Thank you for the help and feedback. May I ask you how can you add extra conditions? For instance setting 0<q<1? I tried this: 0 <= {μ, γ1, γ2, β1, β2, k} <= 1, 0 < q < 1, but I get (* {{k -> 1, q -> -1, β1 -> 0, β2 -> 1, γ1 -> 1, γ2 -> 0, μ -> 0, Ν -> 2000}} *), so I'm wondering if the code is set in a way to always hold no matter if it needs to skip some step or I'm doing something wrong? Because the important part is to check whether the inequality holds under some conditions and not to make the inequality hold necessarily. $\endgroup$
    – Vicky
    Commented Jul 7, 2020 at 22:30
  • $\begingroup$ The original constraints included 0 <= q <= 1 if you want to tighten the constraint on q use con = Flatten[{(k + \[Mu])*(\[Gamma]1 + \[Mu]) - \[Beta]1*\[CapitalNu]*k*(1 - q)*(\[Gamma]2 + \[Mu]) > 0, Thread[0 <= {\[Kappa], \[Mu], \[Gamma]1, \[Gamma]2, \[Beta]1, \[Beta]2, k} <= 1], 0 < q < 1, \[CapitalNu] == 2000}]; $\endgroup$
    – Bob Hanlon
    Commented Jul 7, 2020 at 22:39

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.