I've written program for finding critical value in Python.
My code:
from sympy import *
def find_critical_points(f, x):
fd = diff(f)
dRoots = solveset(fd, x)
a = Rational(float(dRoots))
return a
And I wrote test for that:
x = Symbol('x')
lst = find_critical_points(x**4+x**3, x)
assert lst == [-3/4,0]
lst = find_critical_points(x,x)
assert lst == []
Python return me error:
float() argument must be a string or a number, not 'FiniteSet'
Please help with this error.