0
$\begingroup$

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$.

$\endgroup$
  • $\begingroup$ Matlab has now a "sylvester" function uk.mathworks.com/help/matlab/ref/sylvester.html $\endgroup$ – Jean Marie Mar 11 at 21:41
  • $\begingroup$ Why not use vectorization? $\endgroup$ – Rodrigo de Azevedo Mar 11 at 21:45
  • $\begingroup$ @JeanMarie Yes, but the input arguments must be numeric arrays. $\endgroup$ – Mohammad Mar 11 at 21:46
  • $\begingroup$ @RodrigodeAzevedo Can you please describe more? $\endgroup$ – Mohammad Mar 11 at 21:46
  • $\begingroup$ Vectorization converts the matrix equation into a system of $4$ linear equations in $4$ unknowns, which is easy to solve symbolically. In MATLAB, use kron for the Kronecker product and reshape for the vectorization and un-vectorization. $\endgroup$ – Rodrigo de Azevedo Mar 11 at 21:48
2
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.