On Thu, May 15, 2008 at 9:48 PM, John H Palmieri <[EMAIL PROTECTED]> wrote:
>
> Is this a bug?
>
> sage: 3 == pi
> 3 == pi
> sage: i == i
> I == I
>
> Shouldn't this return "False" and "True", respectively?
Those are symbolic equations:
sage: type(I == I)
<class 'sage.calculus.equations.SymbolicEquation'>
It's just a more general case of:
sage: var('a,b,c,x')
(a, b, c, x)
sage: a*x^2 + b*x + c == 0
a*x^2 + b*x + c == 0
sage: type(a*x^2 + b*x + c == 0)
<class 'sage.calculus.equations.SymbolicEquation'>
sage: solve(a*x^2 + b*x + c == 0, x)
[x == (-sqrt(b^2 - 4*a*c) - b)/(2*a), x == (sqrt(b^2 - 4*a*c) - b)/(2*a)]
That said, maybe something so obvious as I == I would best be simplified
to True. But then people would argue that it is very inconsistent that
sometimes symbolic equations are simplified to True/False and sometimes
they aren't.
In all cases you can do bool( a symbolic equation ) to get True or False.
sage: bool(I == I)
True
> I know this
> works:
>
> sage: 3 == pi.n()
> False
> sage: 3 == RR(pi)
> False
>
> but I sort of expect pi to act like the number pi when used with
> things like == or <, without using the .n() decoration.
Nope. Pi is symbolic.
I'm certainly open to doing some simplification to True/False of symbolic
equalities though, when we can do so. I think the main reason we don't
now is simply that nobody implemented it. Comments welcome.
-- William
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---