1

I want to create determinant solution for matrix. What I think? Click here for example in this link, is created how to find determinant of matrix. I want to do it animated, every step. Make it animated is easy, but problem is, when I want to do it animated, and i want to do it like app. So when you change the values of every node in matrix for number, it will solve determinant. I want to use it for students in school, I believe, then it helps imagine what is it doing. Also, when I change the nodes, we can apply it on every matrix with 3 x 3 dimensions.

I tried to write some algorithm, and apply it, but we start using LaTeX only month ago, so my experience and skills are not for this kind of work.

What i got is:

\documentclass{article}
\usepackage{latexsym,amssymb,amsmath,amsfonts,amsthm,upref,indentfirst,graphicx,eucal,makeidx}
\usepackage{mathtools, nccmath, textcomp} %mfrac
\usepackage{enumerate}
\usepackage[dvipsnames,svgnames]{xcolor}
\usepackage{tcolorbox,picture}
\usepackage[slovak]{babel}
\usepackage[utf8]{inputenc}
\usepackage[IL2]{fontenc}
\usepackage{supertabular}
\usepackage{emptypage}
\usepackage{multicol,multirow}
\usepackage{tabularx}
\usepackage{cancel}
\theoremstyle{plain}
\newtheorem{theorem}{Theorem}
\newtheorem*{theorem*}{Theorem}
\theoremstyle{definition}
\newtheorem{example}[theorem]{Príklad}
\usepackage{animate}
\usepackage{tikz}
 \usetikzlibrary{matrix,patterns,arrows,decorations.pathreplacing}

\begin{document}

\begin{tikzpicture}
\useasboundingbox(-5,-9) rectangle(15,5);%nastavenie prac.ploch. 
\draw [help lines, dashed,step=1cm] (-5,-9) grid(10,10); %pom.čiar
    \fill [red] (0,0) circle[radius=3pt]; %vyznačenie [0,0]

\def\a{{{11,12,13},{41,52,63},{77,88,99},{11,12,13},{41,52,63}}};
\def\print#1{\pgfmathparse{#1}\pgfmathresult};

\def\scitanie{\a[1][1]*\a[2][2]*\a[3][3], %sčítanie prvkov
          \a[2][1]*\a[3][2]*\a[1][3],
          \a[3][1]*\a[1][2]*\a[2][1]};

\def\odcitanie{\a[1][3]*\a[2][2]*\a[3][1], %odčítanie prvkov
          \a[2][3]*\a[3][2]*\a[1][1],
          \a[3][3]*\a[1][2]*\a[2][1]};  

\def\zacx{4};       
\def\zacy{2};
\def\pole{0.2};

\def\identitymatrix{{{11,12,13},{41,52,63},{77,88,99}}}
\foreach \i in {0,1,2} \foreach \j in {0,1,2} 
\node at (\i,-\j) [anchor=base] {\print{\identitymatrix[\i][\j]}};


\foreach \i in {1,2,3}{
\foreach \j in {1,2,3}{     
\node at (1,-4) {\a(\i)(\j)};

\ifnum \j<3 
\node at (1,1) {*};
\fi
};
\ifnum \i=3
\node at (1,1) {=};
\else
\node at (1,1) {+};
\fi
};

\foreach \i in {1,2,3}{
\foreach \j in {3,2,1}{
\node at (1,-1) {(\a[\i-\j+3][\j])};
\ifnum \j>1
\node at (0,1) {*}; 
\fi
};
\ifnum \i=3 
\node at (1,1) {=};
\else
\node at (2,1) {-};
\fi
};

\foreach \i in {1,2,3}{
\node at (2,-2) {\scitanie[\i]};
\ifnum \i<3
\node at (2,-3) {+};
\else
\node at (2,-4) {-};
\fi
};

\foreach \j in {3,2,1}{
\node at (3,-5) {\odcitanie[\j]};
\ifnum \j<3
\node at (3,-6) {-};
\else
\node at (3,-7) {=};
\fi
};


\end{tikzpicture}
\end{document}

I have problem, then it doest returning the values from matrix \a by \i or \j i created. It only return the full matrix a, but not like i want. There you can see the example from TikZ manual, with this written matrix. There is working manipulation with values in matrix. what it should do: i want to read the values in matrix like the rule is saying fr example: we have matrix [1 2 3][4 5 6][7 8 9] so it will do 1*5*9+4*8*3+7*2*6-3*5*7-6*8*1-9*2*4 = 45+96+84 .... etc and the last it will write result (determinant). After these all, i want to use \multiframe and animate it. I have done it with \newframe commands, but i want make it universal. If is it possible, now i am in situation, then i really dont know if it will works or not on LaTeX. Instead, maybe solving determinant for matrix 2 x 2 is more realistic, so I will chose this way, if this is not able to work. In conclusion thank you all for your answers and help.

EDITED: added full code. Note: i don't have so much and what i got is not working properly.

There is also example:

  • Please provide a complete and (if possible) compileable code example. – Dr. Manuel Kuehner Apr 6 '17 at 14:23

Your Answer

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

Browse other questions tagged or ask your own question.