1
$\begingroup$
Resolve[ForAll[n,Element[n,Integers],!IntegerQ[Sqrt[n^2-7 n-1]]]]

True

But as I know,when the n is $17$,Sqrt[n^2 - 7 n - 1] is $13$(integer).What's happen of this function?

$\endgroup$
  • $\begingroup$ ForAll[] doesn't work that way. Resolve[ForAll[n, Element[n, Integers], ! IntegerQ[n]]] also evaluates to True. $\endgroup$ – Feyre Feb 13 '17 at 13:17
  • 1
    $\begingroup$ @Feyre Funny,ForAll[n, ! IntegerQ[n]] will give True,too.Why? $\endgroup$ – yode Feb 13 '17 at 13:21
1
$\begingroup$

All functions ending in Q evaluate to True or False immediately. Therefore IntegerQ[x] is False if x has no value.

You are essentially writing

Resolve[ForAll[n, Element[n, Integers], True]]

so you get True.


IntegerQ is a "programming function" that tests the data type of the argument. It is not a "mathematical function" that will stay unevaluated with symbolic arguments and can represent a mathematical statement.

Use something \[Element] Integers instead.

$\endgroup$
  • $\begingroup$ So how to write the code will be my original intention? $\endgroup$ – yode Feb 13 '17 at 14:12
  • $\begingroup$ @yode Use Element or NotElement, as I said in the last line of the answer. Mathematica will not be able to solve this problem though. $\endgroup$ – Szabolcs Feb 13 '17 at 14:28
  • $\begingroup$ Good lesson to me.Thanks. $\endgroup$ – yode Feb 13 '17 at 14:36

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.