6

I have some quadratics, and I am trying to find out whether there exist solutions in the integers. The following tells me that the first does, wheraeas the second doesn't:

Solve[2 + 4 x + 6 x^2 == 4 - 7 y + 3 y^2 && x < 0 && y < 0, x, Integers]
Solve[12 + 15 x + 9 x^2 == 4 - 7 y + 3 y^2 && x < 0 && y < 0, x, Integers]

This is fine. However, I am not particularly interested in what the solutions are, just whether a solution exists. I have a lot of these, and it is taking a long time to calculate, since it is trying to find a solution for each one.

Generally, if there isn't a solution, it spits out {} quite quickly (which is all I really want to know). Is it possible to find out whether such equations have integer solutions, without having to evaluate each one, and hence speed up calculation times?

Dr. belisarius
  • 115,881
  • 13
  • 203
  • 453
martin
  • 8,678
  • 4
  • 23
  • 70
  • Perhaps FindInstance? Can't guarantee that it's faster, though. Don't know too much about it. – march Jan 04 '16 at 18:14
  • @march Good suggestion. The two functions are comparable in run time for the two examples, but FindInstance gives a cleaner answer - no ConditionalExpression, Reduce is slightly faster then either for the example above when no solution exists. – bbgodfrey Jan 04 '16 at 19:12

1 Answers1

1

I hope there is a better solution for you, but why not try something like this:

TimeConstrained[Solve[12 + 15 x + 9 x^2 == 4 - 7 y + 3 y^2 && x < 0 && y < 0, x, Integers], 0.01]

You might optimize the time to abort for your machine.

M. Stern
  • 1,159
  • 6
  • 13