5
$\begingroup$

Mathematica fails to do anything with

Reduce[Abs[x-3]<4, Reals]
(* Reduce[Abs[x-3]<4, Reals] *)

This answer contends that explicitly naming the variables to be reduced will solve the problem, and indeed

Reduce[Abs[x-3]<4, x, Reals]
(* -1 < x < 7 *)

But why is this the case? If either the absolute value is removed, or the < is changed to =, it is not necessary to provide the variable name.

$\endgroup$
1
  • $\begingroup$ you can do Reduce[RealAbs[x - 3] < 4]. $\endgroup$
    – rmw
    Commented Dec 31, 2019 at 10:46

2 Answers 2

6
$\begingroup$

After some back and forth with WRI, here is the answer: the domain restriction in Reduce[] applies to the specified variables and functions involving those variables. Since no variables are specified in my first example, the domain restriction effectively does nothing. That also explains why using {} does not solve the problem.

EDIT: After reading @Michael's comment below, I had more interactions with Wolfram support, and I am still somewhat confused. From WRI:


From Reduce documentation:

"Algebraic variables in expr free of the Subscript[x, i] and of each other are treated as independent parameters."

Since no Subscript[x, i] are specified, Reduce solves for the algebraic-level variables that are free of other algebraic-level variables.

In[1]:= Reduce`FreeVariables[x^2<4, "Algebraic"]
Out[1]= {x}

In[2]:= Reduce`FreeVariables[Abs[x-3]<4 && x\[Element]Reals, "Algebraic"]
Out[2]= {x}

In[3]:= Reduce`FreeVariables[Abs[x-3]<4, "Algebraic"]
Out[3]= {Abs[-3 + x]}

In[4]:= Reduce`FreeVariables[Re[x] > 0, "Algebraic"]
Out[4]= {Re[x]}

I guess the point is that x appears "algebraically" only in the first example; in the other examples it is the Abs or Re expression that is the "algebraic-level" variable.

This is still pretty unclear to me at a conceptual level (although I now know how to get the results I want), but I'm not sure what further questions to ask to clarify the situation. BTW, Reduce``FreeVariables is not documented.

$\endgroup$
9
  • $\begingroup$ That was my first thought, which I put in a comment, but I deleted the comment after finding it was contradicted in the docs, the relevant parts of which I quote in my answer. Note that the Subscript[x, i] refer to the specified variables. The identification and treatment of the parameters seems explicit, deliberate and clear, which makes me think the techie that helped you didn't look thoroughly into the matter. It's happened to me before. Or the docs are wrong, but, as I said, the docs seem intentionally to make the point. $\endgroup$
    – Michael E2
    Commented Jan 2, 2020 at 14:47
  • $\begingroup$ @MichaelE2 Just tagging you so you see the edit to the answer. I'd appreciate any further insights. $\endgroup$
    – rogerl
    Commented Jan 6, 2020 at 16:06
  • $\begingroup$ I think (guess) what they are saying is that Reduce[expr, vars, dom] is equivalent to something like Reduce[expr, Union[Reduce`FreeVariables[{expr, {vars}}, "Algebraic"], Flatten@{vars}], dom], where vars and dom may be omitted. Union is not quite right because the order of vars matters and the additional free variables ("parameters") are treated as though order does not matter, at least not in the same way (another guess). It seems the docs are incomplete, which is not that unusual unfortunately. They tend to leave out things most users don't need to know. $\endgroup$
    – Michael E2
    Commented Jan 6, 2020 at 16:55
  • 1
    $\begingroup$ If you haven't seen it, you might be interested in this Q&A $\endgroup$
    – Michael E2
    Commented Jan 6, 2020 at 17:01
  • 2
    $\begingroup$ @MichaelE2 What a rat's nest. I thought I was just asking a simple question... $\endgroup$
    – rogerl
    Commented Jan 6, 2020 at 19:58
4
$\begingroup$

I suspect Reduce treats the second argument as a variable. For instance:

Reduce[2 Reals == 1, Reals]
(* Reals == 1/2 *)

So I'm not sure there's anything wrong with

Reduce[Abs[x-3] < 4, Reals]
(* Reduce[Abs[x-3] < 4, Reals] *)

However, from the docs ("Details"):

Reduce[expr,vars,dom] restricts all variables and parameters to belong to the domain dom.
...
Algebraic variables in expr free of the Subscript[x, i] and of each other are treated as independent parameters.

I think this means that in Reduce[Abs[x-3]<4, {}, Reals], the x is not treated as a variable (to be solved for) but as a parameter, assumed to be real. Yet it still does not solve the inequality:

Reduce[Abs[x-3]<4, {}, Reals]
(* Abs[x-3]<4 *)

If you put the constraint in directly, you get the sought-after result:

Reduce[Abs[x - 3] < 4 && x \[Element] Reals, {}, Reals]
(* 1 < x < 7 *)

I would expect to get the same thing for Reduce[Abs[x-3]<4, {}, Reals], since x \[Element] Reals is supposed to be assumed.

It may be a bug and should be reported to WRI. See if they have an explanation.

$\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.