I think the issue is really one of the computational domain, and whether the
cancellation is always valid in that domain.  In the formal algebraic 
structure
  (rational field extended by the indeterminate [x])  the cancellation is 
valid.

The behavior of  (x^2-1)/(x-1)    is always indistinguishable from  x+1.   
Even at x=1.

But but but .... you say what about diviision by zero?  Eh, if you want to 
write
a program that keeps track of such things, go ahead.  You could use sympy
to help you.  But it would be a mistake to require sympy to always keep 
track.
Too expensive in time and especially space.

RJF


On Wednesday, May 14, 2014 10:50:15 AM UTC-7, Aaron Meurer wrote:
>
> The noncancellation is also about computational issues here. 
> Automatically performing a cancel when an object is created could be 
> potentially be very expensive. However, SymPy automatically cancels 
> terms. Actually, it just combines exponents, so x*x becomes x**2, 
> x/x**2 becomes 1/x and x/x becomes x**0 == 1 (these are all the same 
> because SymPy treats 1/x as x**-1). Of course, anything with a 
> nonpositive exponent does not make sense if x is 0. 
>
> Without knowing more of what you are doing, I can't give the best 
> advice, but I would suggest just keeping the numerator and denominator 
> separate. 
>
> Aaron Meurer 
>
>
>
> On Tue, May 13, 2014 at 7:08 PM, Eric Dennison 
> <[email protected]<javascript:>> 
> wrote: 
> > When I type in an expression (x is a symbol): 
> > 
> >>>> (x**2-1)/(x-1) 
> > (x**2 - 1)/(x - 1) 
> > 
> > One presumes this does not do any automatic cancellation because we 
> don't 
> > want to lose undefined behavior at x = 1. 
> > 
> > Then, 
> > 
> >>>> (x+1)*(x-1)/(x-1) 
> > x + 1 
> > 
> > or 
> > 
> >>>> (x-1)/(x-1) 
> > 1 
> > 
> > This oversimplifies the expression and loses the undefined behavior at x 
> = 
> > 1. 
> > 
> > Is it possible to create an expression like the latter that does not get 
> > oversimplified? 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "sympy" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an 
> > email to [email protected] <javascript:>. 
> > To post to this group, send email to [email protected]<javascript:>. 
>
> > Visit this group at http://groups.google.com/group/sympy. 
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/sympy/0b461aec-c962-407a-b886-48d7d464f4f8%40googlegroups.com.
>  
>
> > For more options, visit https://groups.google.com/d/optout. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/20e8fce5-fd92-403a-9667-f64d896fe102%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to