On Sun, Mar 4, 2012 at 8:00 AM, Joachim Durchholz <j...@durchholz.org> wrote: > Am 04.03.2012 14:09, schrieb prateek papriwal: > >> also the addition of two positive irrational number is also irrational . > > > A trivial counterexample: > 2 +/- sqrt(2) are positive and irrational, yet their sum is 4, which is > rational. > > There are less trivial cases. > Such as the sum of 1/(sqrt2-1) and 2-sqrt(2), which is 3. > (Taken from Wikipedia and trivially modified, but unvalidated.) > > > In more generality, I'm a bit concerned that we're investing a lot of effort > into building a rationality test that works only for a small class of > numbers. It would probably be better to make this extensible, so that people > can add more algorithms as we pick up techniques.
As I noted earlier, you can test this for any algebraic number by using minpoly(), but currently that algorithm is too slow for non-trivial expressions (there are also some other bugs and problems if I remember correctly). It's when you want to start including transcendentals that you start getting things you can't decide. For example, it's not even known if pi + E or pi*E is irrational (though it is known that at least one is). And if you have a combination of symbolic values of irrational or transcendental, you generally can't say much, because things can easily cancel like sqrt(2) - sqrt(2) or pi - pi. Aaron Meurer > > Background: Testing for rationality in general is an undecidable problem. It > is proven to be impossible to have an algorithm that will work for arbitrary > formulae. There are two possible failure modes: > - The algorithm is correct but may run into an endless loop. > - The algorithm is incorrect. > - The algorithm returns "rational", "irrational", or "don't know". > The third behaviour is not ideal, but I doubt the other two are acceptable. > > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To post to this group, send email to sympy@googlegroups.com. > To unsubscribe from this group, send email to > sympy+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/sympy?hl=en. > -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to sympy@googlegroups.com. To unsubscribe from this group, send email to sympy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.