While trying to answer another SO question, the issue of how to calculate Euler angles for dimensions > 3 came up. The RSpincalc
package has a straightforward DCM2EA
function for converting a 3d rotation matrix to Euler or Tait-Bryan angles, but this only handles the specific case of 3 dimensions. The wikipedia page on Euler angles briefly discusses the issue of extending Euler angles to higher dimensions and cites an Italian paper which apparently generalises the method to greater numbers of dimensions. Unfortunately, neither my Italian nor my maths are quite up to taking that paper and creating a usable R function.
My current method, used in this answer is a little cumbersome, to say the least. I use the Ryacas
package to create a symbolic matrix which is the composite of a series of rotations for an arbitrary number of dimensions. This can then be solved iteratively against a known rotation matrix to find the angles required. It works, but it gets increasingly slow once the number of dimensions is 5 or more.
Is there a better way to achieve this objective, either through implementation of the method in the Italian paper or something else?