It's a feature.
In your first example, where you have not defined x, it is treated as
a symbol and the expressions you create using x are purely symbolic;
in fact they are objects within the underlying maxima system. In this
system, "==" is used to create equations, not to test equality. And
in that system, certainl simplifications are done automatically.
In your second example, you are creating a specific ring containing an
element x, namely the ring of polynomials on one variable x over QQ.
Your expressions now live in that ring (or its function field). This
is a Sage ring, and == is a boolean test.
I agree that this is confusing. Sage is trying to cater
simultaneously for different kinds of users, including those who
expect a symbolic system like maxima and those who expect to have to
define rings "properly" as in Magma. The latter can result is very
much faster code.
I hope this helps -- and it is likely that a more definitive answer
will come from others on the Sage development team.
John
On 08/02/2008, Simon King <[EMAIL PROTECTED]> wrote:
>
> Dear Sage team,
>
> i met the following bug/feature:
>
> sage: ((-x^4-1)/(x^2)) == ((x^4+1)/((-1)*x^2))
> (-x^4 - 1)/x^2 == (-x^4 - 1)/x^2
>
> That's to say, the expressions are displayed in the same canonical
> form, but "==" does not return True.
>
> Is this worth a ticket?
>
> ----------------
>
> Another potential bug:
>
> sage: Ring=PolynomialRing(QQ,'x')
> sage: x=Ring('x')
> sage: ((-x^4-1)/(x^2))
> (-x^4 - 1)/x^2
> sage: ((x^4+1)/((-1)*x^2))
> (x^4 + 1)/-x^2
>
> Why are these expressions not turned into a canonical form, in
> contrast to above? And how can i achieve such canonical form?
>
> Is this also worth a ticket?
>
> sage: ((-x^4-1)/(x^2)) == ((x^4+1)/((-1)*x^2))
> True
>
> So, at least "==" works as it should.
>
> Yours sincerely
> Simon
>
> >
>
--
John Cremona
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---