0
$\begingroup$

I have a simple function and want to make sure that it satisfies an inequality over a certain range of parameters.

My approach is:

In[125]:= a[x] := x^2

In[126]:= Reduce[a[x] > 0 && 1 <= x <= 2]

Out[126]= 1 <= x <= 2

However, I would expect an output of "True", since the inequality is satisfied over the entire range.

What do I need to invoke in order to obtain "True" as a result?

Thanks!

$\endgroup$
  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$ – user9660 Apr 2 '15 at 8:48
  • 2
    $\begingroup$ Reduce solves the system of inequalities and returns the range of x in which the system is true. this code returns True Refine[Reduce[a[x] > 0, x], 1 <= x <= 2] $\endgroup$ – k_v Apr 2 '15 at 8:57
1
$\begingroup$

Reduce is designed to reduce a set of inequalities to obtain the relevant information. In your case.

In:

Reduce[x^2 > 0 && 1 <= x <= 2]

Out:

1 <= x <= 2

tells you that your first inequality x^2>0 was an obsolete infomation, for the set of inequalities. In other words this tells you, that the first equation is allways satisfied if the second equation is satisfied.

So its a problem of interpretation here.

If you want to have an explicit test, that yields True or False, you could simply use this:

satisfiesInequality[ineq_, range_] := 
Reduce[ineq && range] === Reduce[range]

another approach would be to integrate the Boole-Function over the range where you want to test the first inequation.

satisfiesInequality2[
ineq_, {x_, xmin_, xmax_}] := (1 === 
Integrate[Boole[ineq], {x, xmin, xmax}]/(xmax - xmin))

add some SyntaxInformation that helps you using the function correctly:

SyntaxInformation[
satisfiesInequality2] = {"LocalVariables" -> {"Plot", {2, 
  Infinity}}, "ArgumentsPattern" -> {_, {_, _, _}}};
$\endgroup$
3
$\begingroup$

Let's rephrase your problem:

Show that $x^2 > 0$ for all $1\leq x\leq 2$.

or

$\forall_{x\in\left[1,2\right]}\;x^2>0$

Turns out Mathematica has a command for that, ForAll:

Reduce[ForAll[x, 1 <= x <= 2, x^2 > 0]]
(* True *)
$\endgroup$

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.