# Solving a general ODE

$$\newcommand{\der}[1]{\frac{d^#1 u}{dx^#1}}$$ I'm trying to solve $$\der n =\sum^{n-1}_{k=0}\alpha_k\der k +e^{-x}.$$ It can be transformed to an set of equations: $$\begin{cases} u_0'=u_1\\ u_1'=u_2\\ \vdots\\ u_{n-1}'= \sum^{n-1}_{k=0}\alpha_ku_k +e^{-x} \end{cases}$$ And in matrix form: $$\begin{pmatrix}u_0\\u_1\\u_2\\\vdots\\u_{n-1}\end{pmatrix}'=\begin{pmatrix} 0&1&0&\dots&0\\ 0&0&1&\dots & 0\\ 0&0&0&\ddots&0\\ \vdots&\vdots&\vdots&\ddots&\vdots\\ \alpha_0&\alpha_1&\alpha_1&\dots&\alpha_{n-1}\\ \end{pmatrix}\begin{pmatrix}u_0\\u_1\\u_2\\\vdots\\u_{n-1}\end{pmatrix}+\begin{pmatrix}0\\0\\0\\\vdots\\e^{-x}\end{pmatrix}$$ Now, I can start by solving the homogenous form: $$\begin{pmatrix}u_0\\u_1\\u_2\\\vdots\\u_{n-1}\end{pmatrix}'=\begin{pmatrix} 0&1&0&\dots&0\\ 0&0&1&\dots & 0\\ 0&0&0&\ddots&0\\ \vdots&\vdots&\vdots&\ddots&\vdots\\ \alpha_0&\alpha_1&\alpha_1&\dots&\alpha_{n-1}\\ \end{pmatrix}\begin{pmatrix}u_0\\u_1\\u_2\\\vdots\\u_{n-1}\end{pmatrix}$$ I've got stuck here and haven't managed to diagnalize the matrix to exponentiate it.

The matrix in the homogeneous differential equation given in your question is also referred to as companion matrix. Some interesting properties (eigenvalues, eigenvectors, etc.) are summarized in 'The Companion Matrix and Its Properties. Brand, L., The American Mathematical Monthly, 6, 71, p. 629--634, 1964'. The eigenvalues of this matrix correspond to zeros of the polynomial $$f(\lambda)=\lambda^n - \alpha_{n-1} \lambda^{n-1} - \ldots - \alpha_1\lambda-\alpha_0.$$
It is not fully clear from your question if you try to find an analytic solution or if you want to compute a numerical solution. I would not expect a analytic solution to be available in general. Considering numerical solutions, hump effects can occur for the exponential of the companion matrix which can result in numerical difficulties. E.g. for $$f(\lambda)=(\lambda+w)^n$$ with $$w\gg 0$$ the companion matrix with the respective choice of coefficients $$\alpha_0,\ldots,\alpha_{n-1}$$ does have an eigenvalue $$-w\ll 0$$ with multiplicity $$n$$ but the $$\mu$$-norm of this matrix scales with $$w^n$$ (hump effects for short time steps).