1
$\begingroup$

I'm having a problem:

FreeQ[a, _?(# < 0 &)]

returns True when a is kept symbolic.

Shouldn't it hold somehow, returning a conditional expression. How can I make this happen with FreeQ?


P.S.: I am not interested in alternative functions, I just want to understand this behavior.

$\endgroup$

closed as off-topic by m_goldberg, corey979, MarcoB, Feyre, C. E. Jan 28 '17 at 19:45

  • The question does not concern the technical computing software Mathematica by Wolfram Research. Please see the help center to find out about the topics that can be asked here.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    $\begingroup$ You really ought to be doing FreeQ[a, _?(# < 0 &)]. $\endgroup$ – J. M. is away Jan 27 '17 at 15:09
  • $\begingroup$ You are right (edited), but this doesn't solve the problem. $\endgroup$ – MaPo Jan 27 '17 at 15:13
  • 4
    $\begingroup$ I'm voting to close this question as off-topic because the OP is asking for functionality that is not supported given the constraints the OP is putting on the solution. $\endgroup$ – m_goldberg Jan 27 '17 at 18:41
7
$\begingroup$

FreeQ[a, _?(a < 0 &)] is a very odd expression. What exactly is that supposed to do?

With a symbolic (unassigned) a < 0 does not evaluate, and therefore it is not True, i.e. TrueQ[a < 0] evaluates to False. PatternTest only matches on an explicit True, therefore _?(a < 0 &) will match nothing until a has a value. Since the pattern represents an empty set a is free of it.


I see that you fundamentally changed the question.

As noted in the first part of my answer PatternTest matches only on an explicitly True return of its test function. Since a < 0 does not evaluate it does not match.

$\endgroup$
  • $\begingroup$ So how can I make it return a condition on a? $\endgroup$ – MaPo Jan 27 '17 at 15:21
  • 2
    $\begingroup$ @MaPo FreeQ, like most (all?) *Q functions returns either True or False. It is not the correct tool to return a conditional expression. Have you looked at Reduce, Resolve, etc.? $\endgroup$ – Mr.Wizard Jan 27 '17 at 15:21

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