Comment #2 on issue 2717 by asmeurer: apart() should automatically include
algebraic numbers in an expression as an extension
http://code.google.com/p/sympy/issues/detail?id=2717
Probably other polynomials functions should be the same. For example, with
factor() and cancel():
In [26]: print factor(expand((x**2 + 1)*(x - I)))
(x - I)*(x**2 + 1)
In [27]: print factor(expand((x**2 + 1)*(x - I)), extension=[I])
(x - I)*(x + I)**2
cancel() is particularly bad as it can return "wrong results" without the
extension flag:
In [28]: cancel((x**2 + 1)/(x - I))
Out[28]:
2
x + 1
──────
x - ⅈ
In [29]: cancel((x**2 + 1)/(x - I), extension=[I])
Out[29]: x - ⅈ
(factor() is also "wrong" because we expect it to work like cancel() on a
rational function with automatic cancelation of irreducible factors)
Technically, they aren't wrong, because all the operations like the gcd is
defined over a domain, which may or may not include the algebraic
extension, but I think the user may expect the domain to do so when the
number is included in the input expression. And anyway, I certainly don't
think they would expect it to treat algebraic numbers like I as independent
multivariate variables from x and from each other, which is what happens by
default in all these cases.
Of course, some decision will have to be made here. I know you told me that
the algebraic extensions are not used by default because of speed
concerns. So I guess we just have to decide if the results obtained by not
using them are "wrong" enough to warrant using them anyway (because
correctness is more important than speed).
--
You received this message because you are subscribed to the Google Groups
"sympy-issues" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sympy-issues?hl=en.