Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Not understandable error when solving polynomial equation

Hi all,

when I enter command

solve(symbolic_expression(x^12 - x^11 - 12x^10 + 11x^9 + 54x^8 - 43x^7 - 113x^6 + 71x^5 + 110x^4 - 46x^3 - 40x^2 + 8x + 1)==0, var(x), to_poly_solve=True)

I get the expected result, but when I enter command

solve(symbolic_expression(x^10 - 10x^8 + 35x^6 + x^5 - 50x^4 - 5x^3 + 25x^2 + 5x - 1), var(x), to_poly_solve=True)

I get the error message

TypeError Traceback (most recent call last) <ipython-input-203-6108bea90b72> in <module>() ----> 1 solve(symbolic_expression(xInteger(10) - Integer(10)xInteger(8) + Integer(35)xInteger(6) + xInteger(5) - Integer(50)xInteger(4) - Integer(5)xInteger(3) + Integer(25)xInteger(2) + Integer(5)x - Integer(1)),var(x),to_poly_solve=True)

/usr/local/sage-6.4.1-x86_64-Linux/local/lib/python2.7/site-packages/sage/symbolic/relation.py in solve(f, args, kwds) 732 from sage.symbolic.expression import is_Expression 733 if is_Expression(f): # f is a single expression --> 734 ans = f.solve(args,kwds) 735 return ans 736

/usr/local/sage-6.4.1-x86_64-Linux/local/lib/python2.7/site-packages/sage/symbolic/expression.so in sage.symbolic.expression.Expression.solve (build/cythonized/sage/symbolic/expression.cpp:47061)()

/usr/local/sage-6.4.1-x86_64-Linux/local/lib/python2.7/site-packages/sage/symbolic/expression.so in sage.symbolic.expression.Expression.solve (build/cythonized/sage/symbolic/expression.cpp:46887)()

TypeError: 'sage.symbolic.expression.Expression' object does not support indexing

What happened here? The error message is totally misleading (no index in the command!) and it is not to understand why the second command fails while the first works fine.

By the way, the polynomial in question has ten simple real roots, so there should be no problem to compute the roots if symbolic evaluation is not possible.

Thanks in advance Wolfgang

Not understandable error when solving polynomial equation

Hi all,

when I enter command

solve(symbolic_expression(x^12 - x^11 - 12x^10 + 11x^9 + 54x^8 - 43x^7 - 113x^6 + 71x^5 + 110x^4 - 46x^3 - 40x^2 + 8x 12*x^10 + 11*x^9 + 54*x^8 - 43*x^7 - 113*x^6 + 71*x^5 + 110*x^4 - 46*x^3 - 40*x^2 + 8*x + 1)==0, var(x), to_poly_solve=True)

to_poly_solve=True)

I get the expected result, but when I enter command

solve(symbolic_expression(x^10 - 10x^8 + 35x^6 10*x^8 + 35*x^6 + x^5 - 50x^4 - 5x^3 + 25x^2 + 5x 50*x^4 - 5*x^3 + 25*x^2 + 5*x - 1), var(x), to_poly_solve=True)

to_poly_solve=True)

I get the error message

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-203-6108bea90b72> in <module>()
----> 1 solve(symbolic_expression(xInteger(10) - Integer(10)xInteger(8) + Integer(35)xInteger(6) + xInteger(5) - Integer(50)xInteger(4) - Integer(5)xInteger(3) + Integer(25)xInteger(2) + Integer(5)x - Integer(1)),var(x),to_poly_solve=True)

solve(symbolic_expression(x**Integer(10) - Integer(10)*x**Integer(8) + Integer(35)*x**Integer(6) + x**Integer(5) - Integer(50)*x**Integer(4) - Integer(5)*x**Integer(3) + Integer(25)*x**Integer(2) + Integer(5)*x - Integer(1)),var(x),to_poly_solve=True) /usr/local/sage-6.4.1-x86_64-Linux/local/lib/python2.7/site-packages/sage/symbolic/relation.py in solve(f, args, kwds) *args, **kwds) 732 from sage.symbolic.expression import is_Expression 733 if is_Expression(f): # f is a single expression --> 734 ans = f.solve(args,kwds) f.solve(*args,**kwds) 735 return ans 736

/usr/local/sage-6.4.1-x86_64-Linux/local/lib/python2.7/site-packages/sage/symbolic/expression.so in sage.symbolic.expression.Expression.solve (build/cythonized/sage/symbolic/expression.cpp:47061)()

(build/cythonized/sage/symbolic/expression.cpp:47061)() /usr/local/sage-6.4.1-x86_64-Linux/local/lib/python2.7/site-packages/sage/symbolic/expression.so in sage.symbolic.expression.Expression.solve (build/cythonized/sage/symbolic/expression.cpp:46887)()

(build/cythonized/sage/symbolic/expression.cpp:46887)() TypeError: 'sage.symbolic.expression.Expression' object does not support indexing

indexing

What happened here? The error message is totally misleading (no index in the command!) and it is not to understand why the second command fails while the first works fine.

By the way, the polynomial in question has ten simple real roots, so there should be no problem to compute the roots if symbolic evaluation is not possible.

Thanks in advance Wolfgang