# How to find closest exponential approximation?

I have a bunch of data, and I'd like to find the closest exponential aproximation I can to fit the points. I'm guessing there's a (relatively) straightforward way to do this.

For example, if I have the data points (5, 9, 17, 33), the equation I'd be looking for would be f(n) = 2^x + 1, since that would fit the data points exactly. Of course, if I had a similar set of points (5, 9, 16, 33), the equation wouldn't work quite right: f(n) = 2^x + 1 would still be "close", but presumably some other numbers than 2 and 1 could get me ever so slightly "closer".

Is there a way to figure this out? (I'm guessing "yes"). Ideally, I'd like to have it be in the form described above (something^x + possible_constant), though methods for figuring this out in a more general way are welcome, so long as I can tie down some of the parameters (so that any other factors would be forced to be 0).

-
Take the logarithm and do a linear regression. – Qiaochu Yuan Feb 28 '11 at 20:50
@Qiaochu: This works if you multiply rather than add the constant. – Yuval Filmus Feb 28 '11 at 20:52

You can solve for $f(x) = Ca^x$ using linear regression, since $\log f(x) = (\log a)x + \log C$. Here $x$ should be $1,2,\ldots$, and $y$ should be your data points.