Integrals in Python: Add object not callable
问题 I'm trying to solve an integral of a taylor approximation of a sin(x) function by using the trapezoid rule. The code seems fine but it keep giving me the following error: "TypeError: 'Add' object is not callable" This is my code: import math import numpy import sympy as sy import numpy as np from sympy.functions import sin,cos import matplotlib.pyplot as plt x = sy.Symbol('x') f = sin(x) # Factorial function if n <= 0: return 1 else: return n*factorial(n-1) taylor_series = sin(x).series(n