Solve symbolic Sylvester-like equation in MATLAB or MAPLE

206 Views Asked by At

I'm looking for a way to solve a symbolic Sylvester-like equation in MATLAB or MAPLE (or any other available tool). In particular, I have the following equation,

$$AX+XA=B$$

where, $A$ has some parameters in it, e.g.,

$$A=\begin{bmatrix}a+1 & 2\\3 & 1\end{bmatrix}$$

$B$ is known and I want to solve for $X$ as a function of $a$.

1

There are 1 best solutions below

0
On BEST ANSWER

You could write the Sylvester equation as a linear system: \begin{equation} (I_2 \otimes A + A^T \otimes I_2) \mathrm{vec} X = \mathrm{vec} B \end{equation} which you can then solve for $\mathrm{vec}X$: \begin{align} \mathrm{vec}X & = (I_2 \otimes A + A^T \otimes I_2)^{-1} \mathrm{vec} B \\ & = \frac{\mathrm{adj} (I_2 \otimes A + A^T \otimes I_2)}{\mathrm{det} (I_2 \otimes A + A^T \otimes I_2)} \mathrm{vec} B \end{align} and finally reshape back to a 2 by 2 matrix.