Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

It's not clear to me what you want to do. Looking at the first lines of your code: your for-loop ends up with the solutions of x^9 - 1 == 0 ; all other cases are lost.

n=10
for i in range(1,n): 
    v=solve(x^i - 1,x)    
print v
print solve(x^9 - 1,x)

As far as solve returns a list of equations you can run through the list applying the method rhs() (right hand side)

For example:

sols = solve(x^9 - 1,x)
for sol in sols:
    print sol.rhs()

Or (if you are not interested in complex numbers ;-) )

sols = solve(x^9 - 1,x)
for sol in sols:
    if sol.rhs() in RR:
        print sol.rhs()

It's not clear to me what you want to do. Looking at the first lines of your code: your for-loop ends up with the solutions of x^9 - 1 == 0 ; all other cases are lost.lost. (ok, that's wrong, I can see it now after your code was properly formatted)

n=10
for i in range(1,n): 
    v=solve(x^i - 1,x)    
print v
print solve(x^9 - 1,x)

As far as solve returns a list of equations you can run through the list applying the method rhs() (right hand side)

For example:

sols = solve(x^9 - 1,x)
for sol in sols:
    print sol.rhs()

Or (if you are not interested in complex numbers ;-) )

sols = solve(x^9 - 1,x)
for sol in sols:
    if sol.rhs() in RR:
        print sol.rhs()