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

1 Answer 1

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$
3
  • $\begingroup$ So how to write the code will be my original intention? $\endgroup$
    – yode
    Feb 13, 2017 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, 2017 at 14:28
  • $\begingroup$ Good lesson to me.Thanks. $\endgroup$
    – yode
    Feb 13, 2017 at 14:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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