You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The shorthand Poly(expr) for Poly(expr, x) should guess the polynomial variate from the expression expr. However it fails if the polynomial has a coefficient like sqrt(2):
In [6]:roots(sqrt(2)*x**3+ x, x)
Out[6]:
⎧ 3/44 ___ ⎫
⎪ -2⋅ⅈ ╲╱ 2⋅√2⋅ⅈ ⎪
⎨0:1, ────────: 1, ──────────: 1⎬
⎪ 22 ⎪
⎩ ⎭
In [7]:roots(sqrt(2)*x**3+ x)
---------------------------------------------------------------------------
PolynomialError Traceback (most recent call last)
<ipython-input-7-df234384a5fa>in<module>()
---->1roots(sqrt(2)*x**3+ x)
/space/enojb/current/sympy/sympy/sympy/polys/polyroots.py inroots(f, *gens, **flags)
906907if f.is_multivariate:-->908 raise PolynomialError('multivariate polynomials are not supported')
909910 def _update_dict(result, root, k):
PolynomialError: multivariate polynomials are not supported
In [9]:roots(Poly(sqrt(2)*x**3+ x, x))
Out[9]:
⎧ 3/44 ___ ⎫
⎪ -2⋅ⅈ ╲╱ 2⋅√2⋅ⅈ ⎪
⎨0:1, ────────: 1, ──────────: 1⎬
⎪ 22 ⎪
⎩ ⎭
In [14]:roots(Poly(sqrt(2)*x**3+ x))
---------------------------------------------------------------------------
PolynomialError Traceback (most recent call last)
<ipython-input-14-8f8a5579b962>in<module>()
---->1roots(Poly(sqrt(2)*x**3+ x))
/space/enojb/current/sympy/sympy/sympy/polys/polyroots.py inroots(f, *gens, **flags)
906907if f.is_multivariate:-->908 raise PolynomialError('multivariate polynomials are not supported')
909910 def _update_dict(result, root, k):
PolynomialError: multivariate polynomials are not supported
The text was updated successfully, but these errors were encountered:
This is sort of expected behavior of Poly at the moment. The extension flag defaults to False. Maybe it would be better to use the EX domain instead of treating sqrt(2) as a generator, I don't know. For now, it's best practice to pass the variables as the second argument if you know what they are.
I found this while looking at #15408.
The shorthand
Poly(expr)
forPoly(expr, x)
should guess the polynomial variate from the expressionexpr
. However it fails if the polynomial has a coefficient likesqrt(2)
:The text was updated successfully, but these errors were encountered: