Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Also, I meant to mention that this is closely related to, but not the same as, Barry Simon's influential work: A new approach to inverse spectral theory. I. Fundamental formalism, Ann. of Math. (2) 150 (1999), no. 3, 1029–1057. See the paper I linked to for further details on the connections.
Thank you for your answer, which I will have to think about more! The Weierstrass approximation theorem I meant (perhaps Stone-Weierstrass) was that a closed subalgebra of the continuous functions on a compact Hausdorff space, which contains a nonzero constant function, and which separates points is the entire algebra of continuous functions. This can be used in my first comment to show that if all the integrals are actually 0, then a must be 0. That's why I was calling the special case in the comment a quantitative Weierstrass approximation theorem; here take a(x)dx to be a measure,instead