How to compute the inverse of a matrix in matlab?

181 Views Asked by At

I have a matrix $$X=\int_{0}^{2}\begin{bmatrix}P_1^2&-P_1P_2\\ -P_2P_1& P_2^2 \end{bmatrix}ds+\int_{0}^{1}(2-s)^{-0.5}(1-s)^{0.5}\begin{bmatrix}P_1Q_2& P_1Q_1\\-P_2Q_2& -P_2Q_1\end{bmatrix}ds+\int_{0}^{1}(2-s)^{0.5}(1-s)^{-0.5}\begin{bmatrix}Q_2P_1&-Q_2P_2\\Q_1P_1&-Q_1P_2 \end{bmatrix}ds+\int_{0}^{1}\begin{bmatrix}Q_2^2& Q_2Q_1\\Q_1Q_2&Q_1^2\end{bmatrix}ds$$ where $$P_1=1-\frac{(2-s)^{2\alpha}}{\Gamma(2\alpha+1)}+\frac{(2-s)^{4\alpha}}{\Gamma(4\alpha+1)} -\frac{(2-s)^{6\alpha}}{\Gamma(6\alpha+1)}+\cdots\hspace{0.2 cm} \\ P_2=\frac{(2-s)^\alpha}{\Gamma(\alpha+1)}-\frac{(2-s)^{3\alpha}}{\Gamma(3\alpha+1)}+\frac{(2-s)^{5\alpha}}{\Gamma(5\alpha+1)}-\cdots$$ Similarly $Q_1$ and $Q_2$ by replacing $(2-s)$ by $(1-s)$. Then how to compute the inverse of $X$ in matlab? Here $\alpha=0.5$.

1

There are 1 best solutions below

4
On

Once you have grouped all your terms into a $2 \times 2$ matrix, whatever the programming language, you don't need to use the inverse, because there is, in this case, an explicit formula:

$$\pmatrix{a&c\\b&d}^{-1}=\dfrac{1}{\Delta}\pmatrix{d&-b\\-c&a}$$

where $\Delta=ad-bc$ (determinant).

Nevertheless, it will remain a certain number of computations...

Remark: with $\alpha=1/2$, $P_1(s)=\exp(s-2)$, isn't it ? (thanks to Bartgol for the correction).