Can Euler's Formula be generalized for an arbitrary function of $i$? In other words, is it the case that $e^{f(i)n} = cos(n) + f(i)sin(n)$?
The solution to the homogeneous linear difference equation $y[n + 1] = -y[n]$ obtained by the characteristic polynomial method is $y = A(−i)^n + B(i)^n$. Can I start to arrive at the real solution by rewriting this in the following way? $$y = A(−i)^n + B(i)^n$$$$\implies y = Ae^{ln(−i)n} + Be^{ln(i)n}$$$$\implies y = A(cos(n) + ln(−i)sin(n)) + B(cos(n) + ln(i)sin(n))$$$$\implies y = Acos(n) − A\frac{i\pi}{2}sin(n) + Bcos(n) + B\frac{iπ}{2}sin(n)$$
If this is all valid, how can I get from $y = Acos(n) − A\frac{i\pi}{2}sin(n) + Bcos(n) + B\frac{iπ}{2}sin(n)$ to the real solution $y = C(-1)^n$?
Edit: Using Neat Math's comment, I get $$y = A(−i)^n + B(i)^n$$$$\implies y = Ae^{-\frac{\pi n}{2}i} + Be^{\frac{\pi n}{2}i}$$$$\implies y = A(cos(-\frac{\pi n}{2}) + isin(-\frac{\pi n}{2})) + B(cos(\frac{\pi n}{2}) + isin(\frac{\pi n}{2}))$$$$\implies y = Acos(\frac{\pi n}{2}) - Aisin(\frac{\pi n}{2}) + Bcos(\frac{\pi n}{2}) + Bisin(\frac{\pi n}{2})$$$$\implies D = A + B, E = Bi - Ai$$$$\implies Dcos(\frac{\pi n}{2}) + Esin(\frac{\pi n}{2})$$
Is this just some trig trick away from $y = C(-1)^n$?