Cancellation of removable singularities is useful enough that it's
included in the default simplify() heuristics. Without it, it would be
quite annoying to most use cases. It's also not uncommon that in the
process of creating an expression a removable singularity is created,
through multiplying and dividing by some term.

Some functions are more careful about this. For instance, solve((x**2
+ x)/((x - 1)*(x + 1)), x) returns [0], not [-1, 0].

But also be aware that, for instance, x/x always automatically reduces
to 1. This is due to the way the internal representation works in
SymPy. a/b is treated like a*b**-1, and exponents on terms with common
bases always combine automatically.

Aaron Meurer

On Wed, Oct 18, 2017 at 6:28 AM, Kalevi Suominen <jks...@gmail.com> wrote:
>
>
> On Wednesday, October 18, 2017 at 3:08:32 AM UTC+3, EKW wrote:
>>
>> >>> from sympy import *
>> >>> x = Symbol('x')
>>
>> >>> p = (x**2 + x) / ((x - 1)*(x + 1))
>> >>> print(p)
>> (x**2 + x)/((x - 1)*(x + 1))
>> >>> p = simplify(p)
>> >>> print(p)
>> x/(x - 1)
>>
>>
>> This simplification is only valid for x != -1, and I haven't specified any
>> restrictions on the range of x. Was this done on purpose, and if so why?
>
>
> Defining x as a Symbol makes it different from any number.
>
>>>> from sympy import *
>>>> x = Symbol('x')
>>>> x != -1
> True
>
> It is possible to substitute a number for x, but then then the expression
> will also be different.
>
> Kalevi Suominen
>
> --
> 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 sympy+unsubscr...@googlegroups.com.
> To post to this group, send email to sympy@googlegroups.com.
> Visit this group at https://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/c8ec5e5d-56db-45cd-9ec5-013d7074cac8%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 sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAKgW%3D6LpSvucxS0J2OKaNejmockEcAATnc%3DxFF3mLXjf3OQokQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to