1 | initial version |

```
solns = [x == -I, x == I, x == -sqrt(3), x == sqrt(3)]
# We want to eliminate the I imaginaries from solns
realsols=[]
for sol in solns:
if(type(sol.rhs().n())==sage.rings.complex_number.ComplexNumber):
pass
else:
realsols.append(sol.rhs().n())
print(realsols)
# Or if you want symbolic values, drop the .n() and you will get -sqrt(3) and sqrt(3)
Answer:
[-1.73205080756888, 1.73205080756888] or
[-sqrt(3), sqrt(3)]
```

2 | No.2 Revision |

This strikes me as the easiest hack:

~~solns ~~x, y, z = ~~[x ~~var('x, y, z')
P = solve([x^2 * y * z == ~~-I, ~~18, x * y^3 * z == ~~I, ~~24, x * y * z^4 == ~~-sqrt(3), x == sqrt(3)]
# We want to eliminate the I imaginaries from solns
realsols=[]
~~6], x, y, z)
for ~~sol ~~solutions in ~~solns:
~~P:
~~if(type(sol.rhs().n())==sage.rings.complex_number.ComplexNumber):
~~if 'i' not in str(solutions).lower():
~~pass
else:
realsols.append(sol.rhs().n())
print(realsols)
# Or if you want symbolic values, drop the .n() and you will get -sqrt(3) and sqrt(3)
Answer:
[-1.73205080756888, 1.73205080756888] or
[-sqrt(3), sqrt(3)]
~~print(solutions)

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.