Consider a set of matrices
$M_i = \begin{bmatrix} e^{-b_i}(1+a_i) & a_i \\ a_i & e^{b_i} (1-a_i), \end{bmatrix}$
where $a_i$ and $b_i$ are of order $O(1)$. (This is an example of the type of matrices I am dealing with, with negative and positive exponentials on the diagonal and determinant $1$).
Consider now their product
$M = \prod_{i=1}^L M_i$ ,
where $L = O(100)$. I am trying to compute
P=$\Im \log \det [I +M]$
The issue: If I simply compute $M$ numerically it doesn't behave well, because its elements are exponentially large. For example, both eigenvalues I obtain are exponentially large, so $\det M \neq 1$, which is wrong.
My approach: I can obtain P if I compute the eigenvalues of the matrix M. I figured that $\log M$ would be better behave, and I can use it to compute accurately the eigenvalues of M. I know I can compute $\log M$ using the Baker-Campbell-Hausdorff formula. However, it would be a very messy and unpractical approach.
My question: Is there anyway of computing $P$, $\log M$ or the eigenvalues of $M$ directly from the $M_i$ matrices without having to directly compute $M$?
Here's an approach to deal with the numerical instability:
Let $A_i = M_i/\|M_i\|$, where $\|\cdot \|$ denotes the (submultiplicative) matrix norm of your choice (for instance, the Frobenius norm). Let $A = \prod_{i=1}^L A_i$, and let $k = \prod_{i=1}^L \|M_i\|$. We have $$ \begin{align} \log \det(I + M) &= \log \det \left(\frac{k}{k}(I + M)\right) \\ & = \log \left[k^2\det(k^{-1}I + A)\right] = 2 \log(k) + \log \det(k^{-1} I + A). \end{align} $$ I suspect that it will be possible to compute $A$ directly without significant numerical error.