On Mon, 17 Dec 2012 18:15:57 -0800 Benjamin Jones <benjaminfjo...@gmail.com> wrote: <snip> > > It's hard to tell from the implementation if this behavior is > > intentional, unintentional, or a bug. The implementation is just > > that multiplication maps over relational operators like ==, <, <=, > > etc. But I think it's not possible in the current framework to make > > multiplication preserve the truth of a statement, e.g. > > > > if y > 0 is true, > > is x*(y > 0) true or false? > > > > You can't decide unless you know more about x. If you want to make > > multiplying by elements in SR preserve truth of a statement you > > have to decide this. > > <snip> > Sorry for the noise.. I meant to say (at the top) that from the > implementation (of sage.symbolic.expression.Expression._mul_) it's > pretty clear that this behavior *is* intentional, not a bug, but > that's not to say it's desirable in all situations.
This was indeed intentional at the time. When writing the "new symbolics" code based on pynac, William and I thought that this behavior was the one that led to least confusion. Working with expression trees that involve relational objects can be confusing: > f = x < y; x<y > -5*f; -5*(x<y) > sin(-5*f) + x^2; x^2+sin(-5*(x<y)) If arithmetic with relational objects is left unevaluated as above, we have no well established interface to work with these expressions. So we chose the simple solution... This decision led to a lot more confusion than expected and there was an agreement to change it quite a while ago: http://trac.sagemath.org/sage_trac/ticket/7660 It should just be a matter of removing the block starting with if is_a_relational(left._gobj): in the _mul_, _add_, etc. methods of sage.symbolic.expression.Expression. Patches are welcome. Cheers, Burcin -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To post to this group, send email to sage-devel@googlegroups.com. To unsubscribe from this group, send email to sage-devel+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel?hl=en.