I need to compute the sine and cosine of an argument along with n "harmonics"
\begin{matrix} \sin(x) & \cos(x) \\ \sin(2x) & \cos(2x) \\ \cdots \\ \sin(nx) & \cos(nx) \end{matrix}
This takes a lot of computing time and since this is a real-time system, I need to optimize this calculation.
Here's my solution so far :
I defined a rotation matrix $$ R = \begin{pmatrix} \cos(x) \ -\sin(x) \\ \sin(x) \ \cos(x) \\ \end{pmatrix} $$
I compute $[\cos(nx); \sin(nx)] = R [\cos((n-1)x); \sin((n-1)x)]$; I simply iterate to compute the missing $n-1$ harmonics.
This method is 3 times fast than computing all harmonics separately.
I'm curious, are there better solutions? I know a look-up table could be even faster but I would prefer not to go this way.