I am trying to evaluate the matrix function $$ f(X) = \frac{e^X - I}{X}, \tag{1} $$ where $e^X$ is the usual matrix exponential, defined by $$ e^X = \sum_{n=0}^{\infty} \frac{1}{n!} X^n. $$ The problem is that all matrices I am working with are singular (if it is of relevance, $X \in \mathfrak{so}(3)$). According to this Wikipedia article, one may consider the function $f$ to be a real function, find its Maclaurin series, and use this to evaluate the function for a matrix. This seems reasonable enough, and it also seems to be how the matrix exponential is defined. The Maclaurin series for $(1)$ is given by $$ f(x) = \sum_{n=0}^{\infty} \frac{X^n}{(n+1)!} = I + \frac{1}{2!}X + \frac{1}{3!}X^2 + \ldots, $$ indicating that the invertibility of $X$ shouldn't matter when it comes to finding a meaningful value for $(1)$.
Now for my question: Is there a closed form of $(1)$ that do not involve the inverse? To be clear, my goal is to implement the function in Python, and I would rather do it without computing a large partial sum and use that as the approximation. I know a closed form of the matrix exponential for matrices in $\mathfrak{so}(3)$.
$\def\mymatrix#1{ \left[\begin{array}{c}#1\end{array}\right] }$ Nick Higham has a recommendation for calculating such matrix functions.
Write a simple function, applicable to non-singular matrices.
For example, here is some Julia code
For every singular matrix there is a nearby non-singular matrix. So evaluate the simple function by perturbing the singular matrix with a random matrix $(X+R)\,$ where $\,\|R\|\approx\sqrt{\varepsilon}\;$ where $\varepsilon$ is the machine epsilon. The function itself will be accurate to $\sqrt{\varepsilon}\approx10^{-8}$.
So for singular matrices, call the function like so
If this simple method isn't good enough, there are rational (Pade) approximations for the exponential and phi-functions. Here is a fairly comprehensive paper.
Another suggestion is to evaluate the function using quad precision and a perturbation $\|R\|\approx10^{-16}.\;$ Then the function will be accurate to double precision (for singular matrix arguments).
Update
Another approach is to calculate the exponential of a block-triangular matrix $$\eqalign{ \exp\left(\mymatrix{X&I\\0&0}\right) &= \mymatrix{e^X&\frac{e^X-e^0}{X}\\0&e^0} = \mymatrix{e^X&\frac{e^X-I}{X}\\0&I} }$$ then extract the upper-right block. I'm not sure of the numerical accuracy of this method, but it should be as accurate as the underlying $\,\exp\,$ function. Note that this result holds for any analytic function, not just the exponential, i.e. $$\eqalign{ f\left(\mymatrix{X&I\\0&0}\right) &= \mymatrix{f(X)&\frac{f(X)-f(0)}{X}\\0&f(0)} }$$