Solving an equation and finding a couple of results given that they are integer

My problem is to find all solutions to an equation with 2 variables between two values that define the range of my search. e.g., $(x+y-y²)/(1-y-x²)=0$ with solutions ${x,y} \in \mathbb{Z}$.

-

The following might be of use:

Reduce[x + y == y^2 && x^2 + y != 1, {x, y}, Integers]


To ease things, we consider the numerator and denominator separately. Here, we are asking Mathematica for conditions on integer x and y such that the numerator is zero, and the denominator isn't.

Solve[x + y == y^2 && x^2 + y != 1, {x, y}, Integers]


is useful as well.

If you need examples, you can use

FindInstance[x + y == y^2 && x^2 + y != 1, {x, y}, Integers, 10]


Change 10 to the number of examples you wish to generate.

-
thanks the tip of separating numerator and denominator is great ;) – sol May 14 '12 at 10:36
and for the FindInstance 10 that's what I needed! – sol May 14 '12 at 10:47

You can obtain all integer solutions with Reduce:

Reduce[(x + y - y^2)/(1 - y - x^2) == 0, {x, y}, Integers]


which gives

If you also want to restrict to solutions satisfying $x<15$ and $y<42$ then this works

Reduce[(x + y - y^2)/(1 - y - x^2) == 0 && x < 15 && x < 42, {x,y}, Integers]


-
ok thanks and if I want to condition it so that x and y are between [O,1] (how to condition the solving process?) – sol May 14 '12 at 10:29
you can do that in a way analogous to the second example I gave – acl May 14 '12 at 10:34
yep thanks Acl ^^ – sol May 14 '12 at 10:37