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.