Be careful with bool. It will return False for equations that may be true. Simple example:
sage: bool(x == 0) False I believe in some cases it will return False for equations that are actually True if sage doesn't know how to make the necessary simplifications. But if it returns True, you can generally trust that the equation is true. See http://trac.sagemath.org/sage_trac/ticket/3369 JM On Sep 2, 11:38 am, John H Palmieri <[EMAIL PROTECTED]> wrote: > On Sep 2, 8:19 am, "John Cremona" <[EMAIL PROTECTED]> wrote: > > > Putting == between two symbol expressions creates a symbolic equation, > > not a test for equality. There is there fore a difference between > > these: > > > sage: 3 == 3 > > True > > sage: x == x > > x == x > > In the same category as the latter: > > sage: 3 == pi > 3 == pi > sage: bool(3 == pi) > False > > In your situation, 'bool(dSv==dSvq)' returns True. (bool is a > function which 'Returns True when the argument x is true, False > otherwise'.) > > > This behaviour of == is (I think) unique to the symbolic ring in Sage. > > You can test for equality like this: > > > sage: dSv-dSvq > > 0 > > sage: (dSv-dSvq).is_zero() > > True > > > though in more complicated examples the expessions might have to be > > simplified manually. > > > In general in computer algebra, simplifying an expression which > > simplifies to 0 is easier than trying to find two simplifications of > > two expressions which appear to be the same. > > > I'm sure there are computer algebra experts reading this who can > > explain it better. > > > John > > > 2008/9/2 Stan Schymanski <[EMAIL PROTECTED]>: > > > > Dear all, > > > > I must be doing something wrong here, but I don't know what. I'm sure > > > someone will see it straight away: > > > > ---------------------------------------------------------------------- > > > | SAGE Version 3.1.1, Release Date: 2008-08-17 | > > > | Type notebook() for the GUI, and license() for information. | > > > ---------------------------------------------------------------------- > > > > sage: var('myuv myub q qvb qbv') > > > (myuv, myub, q, qvb, qbv) > > > sage: dSv=myuv*qvb - myuv*qbv > > > sage: dSvq=myuv*qvb - myuv*qbv > > > sage: dsage: dSv-dSvq > > > myuv*qvb - myuv*qbv == myuv*qvb - myuv*qbv > > > > Why does SAGE not return 'true'? > > > > Just pointing me to the right page in the docu would help, too! Thanks > > > already. > > > > Stan --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---
