As it was already said in the previous answers and comments, there's no 'ideal' approximation, however, there are some ways to estimate the parameters the OP wants (but not a unique way and never exactly!).
Which is why this post is not as much an attempt to answer the question as posed (since the OP does not clarify what "optimal" means), but just some fun with the problem at hand.
First let's simplify the problem: it's very easy to see that $g(x)=0$ at $x=1/2$.
Which means we can set:
$$\alpha \cos (\omega/2+\phi)=0$$
And (up to addition of $\pi n$ for some integer $n$):
$$\phi=\frac{\pi}{2}-\frac{\omega}{2}$$
$$\alpha \cos (\omega x+\phi)=-\alpha \sin \left(\omega\left(x-\frac12 \right) \right)$$
Now it makes sense to set $t=x-\frac12$ and rewrite both functions:
$$F(t)=-\alpha \sin (\omega t)$$
$$G(t)=\exp \left(-\left(t+\frac12 \right)^2 \right)-\exp \left(-\left(t-\frac12 \right)^2 \right)$$
Using the values of $\alpha, \omega$ the OP provided, we obtain the following plot:
With the error (note that it's zero at $x=0,\pm 1/2$ because we defined $\phi$ that way):
I note that since the OP took $\alpha$ to be the maximal value of $g(x)$, it doesn't have an explicit form, because it represents:
$$\alpha=g(x_m)=g(-0.2717023192091\dots)$$
Where $x_m$ is the negative root of:
$$x(1-e^{-(2x-1)})=1$$
Once we chose $\alpha$ this way, we obtain just a one parameter optimization problem (for $\omega$). Which can be solved in a miriad of ways.
I would like to propose one method, which is not without its own charm.
- One of the many ways to estimate the parameters is to use the first few terms of the Taylor series for $t \to 0$:
$$F(t)=-\alpha \omega \left(t-\frac{\omega^2 t^3}{6}+\frac{\omega^4 t^5}{120}-\frac{\omega^6 t^7}{5040}+ \dots \right)$$
$$G(t)=-\frac{2}{\sqrt[4]{e}} \left(t-\frac{5 t^3}{6}+\frac{41 t^5}{120}-\frac{461 t^7}{5040}+ \dots \right)$$
The series are quite similar (the denominators are all in the form of $(2k+1)!$), though of course there's no way to make them equal for all $t$.
It makes sense to set:
$$\alpha \omega=\frac{2}{\sqrt[4]{e}}$$
Now we again obtain a one parameter problem.
(1) If we pick $\alpha$ from the OP, them $\omega$ is already defined, $\omega \approx 2.13256556$, which is slightly greater than $2 \pi /3 \approx 2.0943951$ and gets the error in the form:
(2) Another simple method to get some values for the parameters would be to equate the first two terms, then we obtain:
$$\omega=\sqrt{5} \approx 2.23607$$
$$\alpha=\frac{2}{\sqrt[4]{25e}} \approx 0.69658$$
Quite different from the OP's values, but that's to be expected. The error is small for small $t$ but increases for larger $t$:
(3) Yet another way is to use the truncated Taylor series and the least squares method, i.e. findins such $\omega$ that:
$$\min \left[ \int_a^b \left( F(t)-G(t) \right)^2 dt \right]$$
For convenience, we choose $a=-1$, $b=1$ and truncate the series at $t^5$, then we are searching for the solution to:
$$\int_{-1}^1 \left( \frac{\omega^2-5}{6} t^3-\frac{\omega^4-41}{120} t^5 \right)^2 dt=\frac{63 \omega^8 - 3080 \omega^6 + 49834 \omega^4 - 269720 \omega^2 + 464503}{4989600}$$
Searching for the global minimum of the above expression (by taking a derivative) we find that it's one of the roots of the equation:
$$63 \omega^6 - 2310 \omega^4 + 24917 \omega^2 - 67430=0$$
It's a cubic equation for $\omega^2$, however the explicit form of the roots is not nice, so it's better to write an approximation:
$$\omega=2.018371488396495 \dots$$
$$\alpha=0.7717120337 \dots$$
This approximation seems worse, but that's because we chose a larger interval, and only considered 3 terms of the Taylor series.
We can certainly imporve the approximation according to the proposed criterion.
Some concluding remarks. The choice for all $3$ parameters is still mostly arbitrary and strongly depends on the optimization criteria we choose. So all of the above is just an example.
Also. This problem has absolutely nothing to do with the golden ratio.
$$f(x)=\dfrac {2^{2 x + 1} - 3^{2 x + 1} - 6^x \cos(π x)}{4^x + 9^x + 2^{x + 1} 3^x \cos(π x)}$$
$$f'(x)=-\frac{5\ 6^x \left(2^{x+1} 3^x \log \left(\frac{3}{2}\right)-\pi
\left(4^x-9^x\right) \sin (\pi x)+\left(4^x+9^x\right) \log
\left(\frac{3}{2}\right) \cos (\pi x)\right)}{\left(4^x+9^x+2^{x+1} 3^x \cos
(\pi x)\right)^2}$$
So, we look first for the zeros of function
$$g(x)=2^{x+1} 3^x \log \left(\frac{3}{2}\right)-\pi \left(4^x-9^x\right) \sin (\pi
x)+\left(4^x+9^x\right) \log \left(\frac{3}{2}\right) \cos (\pi x)$$ for which
$$g'(x)=\log (6) \left(2^{x+1} 3^x \log \left(\frac{3}{2}\right)-\pi
\left(4^x-9^x\right) \sin (\pi x)\right)+$$ $$\left(\pi ^2
\left(9^x-4^x\right)+\log \left(\frac{3}{2}\right) \left(4^x \log (4)+9^x
\log (9)\right)\right) \cos (\pi x)$$
As you noticed, the solutions are quite close to integer values of $x$. So, use the first iteration of Newton methods with $x_0=n$
and you will have
$$x_1=n-\frac{g(n)}{g'(n)}$$
Now, notice that
$$g(2m)=\left(3^{2m}+2^{2m}\right)^2 \log \left(\frac{3}{2}\right)$$
$$g(2m+1)=-\left(3^{2 m+1}-2^{2 m+1}\right)^2 \log \left(\frac{3}{2}\right)$$
Simplify $g'(2m)$ and $g'(2m+1)$ in the same manner.
Repeating @Moo's calculations
$$\left(
\begin{array}{ccc}
n & \text{estimate} & \text{solution} \\
-10 & -9.95477 & -9.95768 \\
-9 & -8.95881 & -8.96124 \\
-8 & -7.95260 & -7.95577 \\
-7 & -6.96159 & -6.96371 \\
-6 & -5.94726 & -5.95114 \\
-5 & -4.96717 & -4.96874 \\
-4 & -3.93239 & -3.93850 \\
-3 & -2.97717 & -2.97793 \\
-2 & -1.87057 & -1.88914 \\
-1 & -0.99178 & -0.99188\\
1 & 0.99203 & 0.99188 \\
2 & 1.91158 & 1.88914 \\
3 & 2.97889 & 2.97793 \\
4 & 3.94558 & 3.93850 \\
5 & 4.97063 & 4.96874 \\
6 & 5.95564 & 5.95114 \\
7 & 6.96623 & 6.96371 \\
8 & 7.95948 & 7.95577 \\
9 & 8.96411 & 8.96124 \\
10 & 9.96108 & 9.95768
\end{array}
\right)$$
Now, you just need to classify the points (just compute the second derivative for $x=n$; this should be more than sufficient)
Best Answer
First of all, discrete Fourier series do not really help here since these functions are not even periodic in general. Instead, the parameters can be recovered by using a linear recurrence. If you sample such a function on a fixed frequency then every five subsequent values satisfy a fixed linear relation. So take $$f(k) = A \cos(\omega_1 k + \varphi_1) + B \cos(\omega_2 k + \varphi_2)$$ for $k \in \mathbb Z$. Assume the generic case where $\cos(\omega_1) \neq \cos(\omega_2)$ and both unequal to $\pm 1$. Then there exist unique $c_1, c_2 \in \mathbb R$ such that $$f(k) + c_1 f(k+1) + c_2 f(k+2) + c_1 f(k+3) + f(k+4) = 0$$ for all $k\in \mathbb Z$. In particular these coefficients can be derived from any six subsequent values of $f$ by solving two linear equations in $c_1, c_2$. The characteristic polynomial for this recurrence factors as $$1 + c_1 x + c_2 x^2 + c_1 x^3 + x^4 = (x^2 - 2 \cos(\omega_1) x + 1)(x^2 - 2 \cos(\omega_2) x + 1).$$ This recovers $\cos(\omega_1)$ and $\cos(\omega_2)$ as solutions of the quadratic equation $$4x^2 + 2 c_1 x + c_2-2 = 0.$$ Now $f$ can be fitted as a linear combination of the four functions $$\cos(\omega_1 k), \sin(\omega_1 k), \cos(\omega_2 k), \sin(\omega_2 k)$$ noting that $$\cos(\omega k + \varphi) = \cos(\varphi) \cos(\omega k) - \sin(\varphi) \sin(\omega k).$$