Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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}$.

share|improve this question
add comment

2 Answers

up vote 7 down vote accepted

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.

share|improve this answer
    
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
add comment

You can obtain all integer solutions with Reduce:

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

which gives

Mathematica graphics

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]

Mathematica graphics

share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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