Comment

Comment by sfpotter

Also pretty easy:

  import numpy as np

  p = np.polynomial.Chebyshev.interpolate(f, degree, domain=(xmin, xmax))

  # insert your code to print out some C code
Also strongly recommend some basic familiarity with the theory. Approximating `Math.abs(x)` to even a few digits of uniform accuracy on any interval containing 0 requires tens if not hundreds of thousands of coefficients.
parent sfpotter 2 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton