Anyone familiar with Mathematica?
Yo
Hey
I need help generating some truth tables using mathematica
What tables?
\[((p->q)||-p)\]
using commands
pp = {True, False}; qq = {True, False}; Table[{"p=" pp[[m]], "q=" qq[[n]], "((p\[Minus]>q)||\[Minus]p)=" Implies[pp[[m]], qq[[n]]] || ! pp[[m]]} , {m, 1, 2}, {n, 1, 2}]
Output \[ \left( \begin{array}{cc} \{\text{p=} \text{True},\text{q=} \text{True},\text{((p-$>$q)$||$-p)=} \text{True}\} & \{\text{p=} \text{True},\text{q=} \text{False},\text{((p-$>$q)$||$-p)=} \text{False}\} \\ \{\text{p=} \text{False},\text{q=} \text{True},\text{True}\} & \{\text{p=} \text{False},\text{q=} \text{False},\text{True}\} \\ \end{array} \right) \]
Give me one sec, I'll show you what I'm putting in
truthtable = BooleanTable[{p, q, Implies[p, q] , Or[Not[p]]}, {p, q}]; TableForm[truthtable, TableHeadings -> {None, {"p", "q", "((p\[RightArrow]q)\[Or]\[Not]p)"}}, TableSpacing -> {1, 4}]
I'm getting the correct truth values for the expression, but I'm also getting an extra row of values
BooleanTable[{p, q}, {p, q}] = {{True, True}, {True, False}, {False, True}, {False, False}}
Your method is better than mine
Join our real-time social learning platform and learn together with your friends!