On Sep 13, 5:53 pm, Mitesh Patel <qed...@gmail.com> wrote:
> On 09/12/2010 10:19 PM, mda_ wrote:
>
> > On Sep 12, 5:44 pm, Mitesh Patel <qed...@gmail.com> wrote:
> >> [...]
> >> This appears to work:
>
> >> sage: bool(e^(-pi/2) == i^i)
> >> True
>
> > Thanks Mitesh.  What is the sage convention for returning the object
> > as a result of "==" instead of bool when the result is not False?  Is
> > it ad hoc?
>
> I can't give an authoritative answer.  As far as I can tell, just
> symbolic relations are not immediately checked for truth.  For example,
>
> sage: 3 <= 3
> True
> sage: 3 <= SR(3)
> 3 <= 3
> sage: bool(3 <= SR(3))
> True
> sage: e == 3
> e == 3
> sage: bool(e == 3)
> False
>
> The bool calls here call Expression.__nonzero__, which is documented in
>
> SAGE_ROOT/devel/sage/sage/symbolic/expression.pyx
>
> In particular,
>
>    Return True unless this symbolic expression can be shown by Sage
>    to be zero.  Note that deciding if an expression is zero is
>    undecidable in general.
>
> > Would you consider float(i^i) raising TypeError a bug?
>
> I believe this happens because Expresssion.__float__ uses just Pynac to
> simplify i^i.  However, if it's necessary, we fall back to Maxima to
> check whether i^i equals e^(-pi/2).

Does sage publish its formal grammar (BNF)?  Perhaps doing so would be
useful.  There are several free tools available: ANTLRWorks, Bison,
Lisp _.

Regards,
Don

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to