Consider a function $f_1$ defined by $f_1(x)=1-x+o(x)$ and $f_1(2x)=f_1(x)^2 + 0$. It's simple to find that $f_1(x)=e^{-x}$ (for example by writing series near $x=0$).
Consider a function $f_2$ defined by $f_2(x)=2-x^2+o(x^2)$ and $f_2(2x)=f_2(x)^2-2$. It can be proven that $f_2(x)=2 \cos(x)$.
Is there any formula (probably with use of special functions) for the generalization of this, i.e. function $f_n$ defined by $f_n(x)=2^{n-1}-x^n+o(x^n)$ and $f_n(2x)=f_n(x)^2-2^{2n-2}+2^{n-1}$?