I would like to know how to write an inverse matrix off A. I have tried everything i could think off but i had no success. Could anybody give me a simple 2×2 example(I donĀ“t know how to get -1 over the matrix bracket). Thank you
[Tex/LaTex] Inverse Matrix of A
matrices
Related Solutions
With amsmath you can use
\xrightarrow{r_{2}-r_{1}}
that will produce an arrow wide enough to accommodate the thing on top.
In order to split matrices you need to use array
\left[\begin{array}{@{}cc|c@{}}
<entries>
\end{array}\right]
With the @{}
at both sides you'll get output similar to that of bmatrix
.
The answer provides two solutions: by means of the first one it is possible to customize the dimension of the squares and perhaps suits better your needs. Both are based on answers given here.
Solution n.1 is based on Create square and custom size cells in a table using pgfplotstable:
\documentclass{article}
\usepackage{filecontents}
\usepackage[table]{xcolor}
\usepackage{pgfplotstable}
\usetikzlibrary{calc}
\pgfplotsset{compat=1.8}
\begin{filecontents}{matrix.cvs}
1 0 1 1 0 1 0 1 0 1 0
1 0 0 1 0 1 0 1 0 1 0
0 1 0 1 0 1 1 1 0 1 0
1 1 1 1 0 0 1 0 1 0 0
0 1 1 0 0 0 1 1 0 0 1
1 1 1 0 1 0 1 0 1 1 1
1 0 1 0 1 0 1 0 1 1 1
\end{filecontents}
\makeatletter
\tikzset{
zero color/.initial=white,
zero color/.get=\zerocol,
zero color/.store in=\zerocol,
one color/.initial=red,
one color/.get=\onecol,
one color/.store in=\onecol,
cell wd/.initial=1ex,
cell wd/.get=\cellwd,
cell wd/.store in=\cellwd,
cell ht/.initial=1ex,
cell ht/.get=\cellht,
cell ht/.store in=\cellht,
}
\newcommand{\drawgrid}[2][]{
\medskip
\begin{tikzpicture}[#1]
\pgfplotstableforeachcolumn#2\as\col{
\pgfplotstableforeachcolumnelement{\col}\of#2\as\colcnt{%
\ifnum\colcnt=0
\fill[\zerocol]($ -\pgfplotstablerow*(0,\cellht) + \col*(\cellwd,0) $) rectangle+(\cellwd,\cellht);
\fi
\ifnum\colcnt=1
\fill[\onecol]($ -\pgfplotstablerow*(0,\cellht) + \col*(\cellwd,0) $) rectangle+(\cellwd,\cellht);
\fi
}
}
\end{tikzpicture}
\medskip
}
\makeatother
\begin{document}
% read the file
\pgfplotstableread{matrix.cvs}{\matrixfile}
\drawgrid{\matrixfile}
\drawgrid[zero color=green, one color=cyan]{\matrixfile}
\drawgrid[zero color=orange,
one color=violet,
cell ht=2em,
cell wd=2em]{\matrixfile}
\end{document}
The result:
Solution n.2 is based on Parametrize shading in table through TikZ:
\documentclass{article}
\usepackage{filecontents}
\usepackage[table]{xcolor}
\usepackage{pgfplotstable}
\pgfplotsset{compat=1.8}
\begin{filecontents}{matrix.cvs}
1 0 1 1 0 1 0 1 0 1 0
1 0 0 1 0 1 0 1 0 1 0
0 1 0 1 0 1 1 1 0 1 0
1 1 1 1 0 0 1 0 1 0 0
0 1 1 0 0 0 1 1 0 0 1
1 1 1 0 1 0 1 0 1 1 1
1 0 1 0 1 0 1 0 1 1 1
\end{filecontents}
\makeatletter
\pgfplotstableset{
zero color/.initial=white,
zero color/.get=\zerocol,
zero color/.store in=\zerocol,
one color/.initial=red,
one color/.get=\onecol,
one color/.store in=\onecol,
color cells/.style={
every head row/.style={output empty row},
string type,
postproc cell content/.code={%
\pgfkeysalso{@cell content=\rule{0cm}{2.4ex}\cellcolor{\zerocol}
\pgfmathtruncatemacro\number{##1}
\ifnum\number>0\cellcolor{\onecol}\fi}%
},
columns/x/.style={
column name={},
postproc cell content/.code={}
}
}
}
\makeatother
\begin{document}
% read the file
\pgfplotstableread{matrix.cvs}{\matrixfile}
\begin{table}
\centering
\pgfplotstabletypeset[color cells]\matrixfile
\end{table}
\begin{table}
\centering
\pgfplotstabletypeset[color cells, zero color=green, one color=cyan]\matrixfile
\end{table}
\end{document}
The result:
Best Answer
Something like this?