Orthogonal polynomial interpolation of a function

I want to write down an arbitrary function $f$ as an (infinite) sum of orthogonal polynomials, e.g. for $f(x) = e^{\sin(x)}$, $f(x) = \sum{a_n T_n}$, where $a_n$ are the coefficients and $T_n$ are the orthogonal polynomials.

So the task is to find the $a_n$, which is easy. But I require the $a_n$ to be left as a nice formula rather than working out the $a_n$ to be horrible numbers like 1.2391000102 etc. etc. or leaving them as integrals. So I guess something like $a_n = \frac13\sin(n)$ or whatever.

When I used Chebyshev polynomials with the discrete orthogonality condition, I ended up with a double sum, so I could not take the limit to infinity by simply replacing the number at the top of sum signs with infinity. It seems I need to choose a function $f(x)$ carefully so that the double sum simplifies, but it is really hard to do so.

Any suggestions, or any ideas for references where such problems are left as questions to the reader (so they probably have nice solutions)? In summary, I'd like a single sum with a nice formula for the $a_n$, and I don't mind what $f$ is or what polynomial system I use.

-
You really can't avoid computing the integrals, and one does not always have the luxury of a closed-form solution for those coefficients. In any case, Hildebrand is something to start with. –  Ｊ. Ｍ. Apr 20 '11 at 16:48
FWIW, your example function $\exp(\sin\;x)$ is already hard enough to integrate symbolically as it is; what more if you multiply it with some polynomials or orthogonal functions? –  Ｊ. Ｍ. Apr 20 '11 at 16:57
Well, I don't have a problem with computing the integral if I can get a general formula for it. But your second point still stands I guess. Thanks, I'll have a look at Hildebrand. Regarding that function, I just picked it randomly. Indeed, I want to choose a function that makes the job as simple as possible. –  A.A Apr 20 '11 at 17:55
Like I said, you can't always have a closed form for those coefficients, and more often than not, you'll have to resort to numerical quadrature for computing them. –  Ｊ. Ｍ. Apr 20 '11 at 18:13
Deleted my answer as I think I misunderstood the question. You don't care what function you use? Why not just build the function as an infinite sum of orthogonal polynomials in the first place, then? –  Daniel McLaury Jan 9 at 7:48