karnaugh-map icon indicating copy to clipboard operation
karnaugh-map copied to clipboard

Ambiguous truth table / minterms / maxterms

Open ukanuk opened this issue 1 year ago • 3 comments

Reading the documentation, it is not immediately obvious to me to which truth table the examples correspond. Knowing the corresponding truth table is critical for knowing which cells correspond to which minterms/maxterms.

After some initial research, I gathered that these examples corresponded to these truth tables:

\begin{karnaugh-map}[4][4][1][$X_0$][$X_1$][$X_2$][$X_3$]
\end{karnaugh-map}
X_0 X_1 X_2 X_3 minterm
0 0 0 0 m_0
0 0 0 1 m_1
0 0 1 0 m_2
0 0 1 1 m_3
\begin{karnaugh-map}*[4][4][4][$a$][$b$][$c$][$d$][$e$][$f$]
\end{karnaugh-map}
a b c d e f minterm
0 0 0 0 0 0 m_0
0 0 0 0 0 1 m_1
0 0 0 0 1 0 m_2
0 0 0 0 1 1 m_3

However after further research, I believe those are exactly reversed from what they should be:

\begin{karnaugh-map}[4][4][1][$X_0$][$X_1$][$X_2$][$X_3$]
\end{karnaugh-map}
X_3 X_2 X_1 X_0 minterm
0 0 0 0 m_0
0 0 0 1 m_1
0 0 1 0 m_2
0 0 1 1 m_3
\begin{karnaugh-map}*[4][4][4][$a$][$b$][$c$][$d$][$e$][$f$]
\end{karnaugh-map}
f e d c b a minterm
0 0 0 0 0 0 m_0
0 0 0 0 0 1 m_1
0 0 0 0 1 0 m_2
0 0 0 0 1 1 m_3

I am still not 100% sure, though. It would be helpful if the documentation made this unambiguous.

ukanuk avatar Sep 03 '24 03:09 ukanuk

It might just be me, but it isn't obvious to me what you are asking here... Care to clarify?

2pi avatar Sep 04 '24 11:09 2pi

Another way of asking the same thing is that with your package when you define \begin{karnaugh-map}*[4][4][4][$a$][$b$][$c$][$d$][$e$][$f$] and then \minterms{1}, does that correspond to a'b'c'd'e'f, or does that correspond to f'e'd'b'c'a.

Is that clearer? I was thinking this could be clarified by including a truth table in the docs, but maybe there's a better way.

ukanuk avatar Sep 04 '24 12:09 ukanuk

Maybe another way of saying it is this -- I am taking a class where the instructor provides this example problem in the lecture, which also matches how an example is given with a truth table on Wikipedia https://en.wikipedia.org/wiki/Karnaugh_map#Example image

While trying to do this example and similar problems for myself in LaTeX with your package, I enter this code which is intuitive to me and find the variables are unexpectedly swapped. image

Of course I noticed this right away, but assumed it was just another re-arrangement of variables and the minterm cell positions would also move accordingly. Just like the minterms are in a different position for this German K-map. https://de.wikipedia.org/wiki/Datei:Karnaugh_map_KV_4mal4_Gruppe102.svg image

I believe that if I had seen in the documentation the equation $f(X3,X2,X1,X0$ or a truth table for the same, I would have realized before doing hours of work that the variables were actually entered in the opposite order I had been expecting.

ukanuk avatar Sep 09 '24 00:09 ukanuk