from sympy import * x = symbols(\'x\') def taylor(f,x,x0, n): t = 0 for i in range(0,n): t = t + ((diff(f,x,i).subs(x,x0))/(factorial(i))) * (x