Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

If you run the following code you get [-0.973248989467730, 0.973248989467730, -0.229752920547361, 0.229752920547361], but if you uncomment assume(x>0) you get [0.973248989467730, 0.229752920547361].

x=var('x')
#assume(x>0)
f(x) = -x*x+x**4+0.05
roots = solve(f(x),x,solution_dict=True)
roots = [s[x] for s in roots]
num_roots = map(n, roots)
print num_roots