On May 21, 5:35 am, Juanlu001 <juanlu...@gmail.com> wrote:
> Yesterday I was playing with symbolic expressions, and I had to apply
> divide_both_sides(), and I encountered something funny: you can divide
> by zero (with a bit of care). To show this, I've taken the classic
> "proof" and created a worksheet:
>
> http://flask.sagenb.org/home/pub/65/
>
> Though I have got useful notices using other functions (such as "Is x
> greater than zero?" when trying to solve an equation), I think that an
> assumption should be made about the expression we are dividing by to
> finally make the division.

Believe it or not, this probably is a feature.   Usually when people
are using symbolics in Sage, this is the desired behavior - similar to
how

sage: 3*x-3*x
0

Yes, even for division.  This is Ginac, and Maxima does the same
thing:

(%i3) f: (a-b)*(a+b)=(a-b)*b;
(%o3)                     (a - b) (b + a) = (a - b) b
(%i4) f/(a-b);
(%o4)                              b + a = b

The questions you get is for when there is really a different answer -
integration, solving at times - and those are Maxima messages.

Otherwise, every time someone tried to divide, we'd have to ask them
interactively whether that was nonzero.  That would be a huge burden.
At least, I think that is the rationale for why Ginac and Maxima do
this.  W|A seems to do it too, but I'm not familiar enough with Mma
syntax to confirm this conclusively.

However, if you don't want this, you could use the hold keyword.

sage: f.mul(1/(a-b),hold=True)
((a - b)*(a + b) == (a - b)*b)/(a - b)

Or with lhs() etc.  Unfortunately, this doesn't seem to be implemented
for the divide_both_sides thing, though that's not surprising, since I
don't think it's used as much as it could be.

- kcrisman

-- 
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