On May 15, 9:56 pm, "William Stein" <[EMAIL PROTECTED]> wrote:
> 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)]

Yes, except I, pi, and e are constants, not variables.

I suppose "bug" is not the right word, but I would content that this
behavior is not at all what beginning users will expect.  I mean, if I
can do 'e**(i * pi)' and get -1, I would expect to be able to do '3 ==
pi' and get "False".

Or maybe I should say, if I can do 'a = 5; a == 7' and get "False", I
would expect to be able to do '3 == pi' and get "False".  Why is pi
treated as a symbolic variable and not as a number?

(Think about this from the beginning user's point of view.  If they
see odd behavior, they're going to be confused.  A goal should be to
not let this happen, or to provide a good way for them to figure out
why the behavior was actually reasonable in the first place. How do
you expect someone to react when they type in '3 == pi'?  If they're
puzzled, what do you reasonably expect them to be able to do to
clarify things?)

> 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 sage-support@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to