The exercise is from the link above. We need to use QSP to estimate the \text{erf} function. I tried to solve that without viewing the hint by estimating the Chebyshev series of erf. I run this externally and copy the coef to the exercise
from numpy.polynomial.chebyshev import chebfit
def integrand(t):
return 2/np.sqrt(np.pi) * np.exp(-t**2)
y = []
x = np.arange(-1, 1, 0.005)
for i in x:
I, _ = quad(integrand, 0, i)
y.append(I)
# do the chebyshev fit
coef = chebfit(x, y, deg=7)
Now I click the hint, and see we use Taylor expansion. That worked, but aren’t we supposed to use Chebysev as HS.5.1 instead of Taylor?