Assigning a variable directly does not modify expressions that used the variable retroactively.
>>> from sympy import Symbol >>> x = Symbol
Actually sympy is designed not to substitute values until you really want to substitute them with subs (see http://docs.sympy.org/latest/tutorial/basic_operations.html)
subs
Try
f.subs({x:0}) f.subs(x, 0) # as alternative
instead of
x = 0