Is it possible to approximate $\cos(x)$ with a linear combination of Gaussians $e^{-x^2}$?

389 Views Asked by At

I am interested in approximating $\cos x$ with a linear combination of $e^{-x^2}$. I am not an expert in approximation theory but there are a couple things that give me a bit of hope that it might be possible (and some other things that worry me it might not be possible or that linear combinations might not be enough).

First thing I did that gave me some hope was write the taylor expansions of both of them and comparing them:

$$ \cos x = \sum^{\infty}_{n=0} \frac{(-1)^n x^{2n}}{ (2n)!}$$

$$ e^{-x^2} = \sum^{\infty}_{n=0} \frac{(-x^2)^n}{n!} = \sum^{\infty}_{n=0} \frac{ (-1)^n x^{2n} }{n!}$$

apart from the denominator, the two power series are nearly identical! However, what worries me is that the factorial function is not easy (for me) to manipulate. Another great thing is that both functions are even, which is definitively great news!

Something else that worries me (about this approximation) is that they behave very differently in the tail ends of each other. For example, the Gaussian function dies off to towards the of the function while the cosine does not and instead oscillates (which is kind of a surprising difference if you only consider their power series, I wouldn't have guessed that difference, which is a very bid difference).

Something else that again gives me some hope about this approximation is the if you plot both $e^{-x^2}$ and $\cos x$, you get:

enter image description here

which even though they are not identical, at least for a bounded interval/domain, look extremely similar! Maybe one could tweak the parameters of one or the other and hopefully get something that might be considered "close" to each other.

So I I was thinking two direction that might be interesting to explore:

  1. An approximation on a bounded interval
  2. An approximation using an infinite series of $e^{-x^2}$ (that might be necessary to reflect on the x-axis to mirror the trough of the wave).

In fact, it might be possible to solve this issue by solving first an approximation of the crest of the cosine using tweeked version of $e^{-x^2}$ and then, using that solution, do an infinite summation of that is reflected on the x-axis. T0 make things more clear, what I kind of had in mind with linear combinations was the following formula:

$$\sum_{k} c_k e^{- \| x - w_k\|^2}$$

with $w_k$ as the movable centers because we might need to center them at the troughs and crests of the cosines. I am open to different tweet suggestions of this (for example, an improvement could be to including a precision $\beta_k$ or a standard deviation $\sigma_k$ on the exponent to adjust the widths to match the cosine better).

I wasn't exactly sure if these were good ideas or if there were maybe better ways to approximate a cosine with $e^{-x^2}$, but I'd love to hear any ideas if people have better suggestions or know how to proceed (rigorously) with the ones I suggested.