如何获得在 python 中解析根的结果?

How do I get the results with the root resolved in python?

如何获得解析根的结果。

a = Eq(x**3 + x**2 - 3*x + 1,0)

b = solve(a)

print(b)

结果:

[1, -1 + sqrt(2), -sqrt(2) - 1]

使用evalf:

In [4]: [s.evalf() for s in b]                                                                                                                 
Out[4]: [1.0, 0.414213562373095, -2.41421356237309]