<![CDATA[Math Is Fun Forum / what is discrete math?]]> 2020-01-20T20:05:35Z FluxBB https://www.mathisfunforum.com/viewtopic.php?id=2650 <![CDATA[Re: what is discrete math?]]> Here is the link to the number of boolean "shapes" using n-variable cubes.
oeis.org/a000616/list

]]>
https://www.mathisfunforum.com/profile.php?id=220178 2020-01-20T20:05:35Z https://www.mathisfunforum.com/viewtopic.php?pid=412205#p412205
<![CDATA[Re: what is discrete math?]]> Okay I'm back.
It turns out the number of irreducible boolean functions of 4 variables is 402.
So the sequence I found on
the web is 3, 6, 22, 402, 1228158, 400507806843728,
527471432057653004017274030725792, (edit: fixed typo on seven variable number.--J.E.F.)
and for eight variables it is very long number according to the internet and is:
11218076601767519586965281984173341005925142853855481024470471657123840.
11218076601767519586965281984173341005925142853855481024470471657123840.
I typed it twice to hope I did it right. (Looks right).

Notice that for 2 variables, the number is 6 "shapes" or 6 irreducible boolean functions.

00
00

01
00

11
00

10
01

11
10

11
11

And that's the six shapes because you can
rotate them to get all sixteen.

(end of post)

]]>
https://www.mathisfunforum.com/profile.php?id=220178 2019-11-13T19:44:30Z https://www.mathisfunforum.com/viewtopic.php?pid=411326#p411326
<![CDATA[Re: what is discrete math?]]> ...So for 3 variables, the 3 circles of a Venn diagram may end up as the front, top, and left of a cube.
The 8 corners of a cube designate the 8 areas in a Venn diagram.  You must count the outside area
as the eighth area in a Venn diagram with 3 circles.  Now if you have this cube with 8 corners, the
corners can have colored beads on the corners.  Since this is boolean algebra, and not ternary, there
are 2 colors (boolean = 2 values, black and white, orange and pear, etc.)  Now the input variables
are usually A, B, and C.    The colors of the corners is the output of true or false (boolean, true or false),
such as the outputs on a "truth table".  Now if you choose the left or right side of the cube, that could
be the variable A.  (Any way you choose is okay, left/right, top/bottom, front/back)  Now the B
variable could be the top and the negation of B would then be the bottom of the cube, 4 corners on
the bottom.  Finally the C variable could the front 4 corners of the cube and the negation of C (called
"C not") could be the back 4 corners of the cube.  Now the fun begins if you combine the different
halves of the cube together with boolean operators such as NAND, AND, OR, NOR, XOR, EQUALITYGATE,
IMPLICATIONGATE, etc....  When you combine two halves of the cube together, then you get a
different shape or pattern of black and white beads in the corners.  What I did is write a short
computer program to iterate all possible combinations of operators and keep track of the complexity
of the equation, by counting the operators in the equation.  Operators is called "gates" in digital
electronics.  I ran the 3 variable case on a PC, and it runs in under a second.  Then I changed
the program (written in C) to 4 variable case (hypercube) and that runs in 20 minutes.  The
result is an equation for all 65536 four variable cases...  Anyway, it was a lot of the fun.
That's all for now, maybe I'll write more later on this in a couple months... Bye.

]]>
https://www.mathisfunforum.com/profile.php?id=220178 2019-08-14T00:22:09Z https://www.mathisfunforum.com/viewtopic.php?pid=410453#p410453
<![CDATA[Re: what is discrete math?]]>
``````0 2 6 4
1 3 7 5

2**0 = 1  2**2=4  2**6=64=40Hex  2**4=16=10Hex
2**1 = 2  2**3=8  2**7=128=80Hex 2**5=32=20Hex

01 04 40 10
02 08 80 20

FF = tautology, always true
00 = falsehood, contradiciton, always false.
F0 = A
0F = not A = /A
55 = B
AA = not B = /B
CC = C
33 = not C = /C
...Note A, B, and C are interchangeable to your liking when starting the definitions...(it depends on the definition of your axes.)
The variables A, B, and C are inputs that create the output conditions when combined together with AND, OR, and XOR,
and also IMP and others...``````
]]>
https://www.mathisfunforum.com/profile.php?id=220178 2019-07-23T05:25:54Z https://www.mathisfunforum.com/viewtopic.php?pid=410170#p410170
<![CDATA[Re: what is discrete math?]]> 00 = 0 trivial case, FALSE

01 = 33 & 05, where 05 = 55 & 0F

03 = 33 & 0F

09 = 99 & 0F, where 99 = CC XOR 55

81 = C3 & A5, where C3 = F0 XOR 33, and where A5 = F0 XOR 55

07 = 0F & 77, where 77 = 55 OR 33

83 = F0 XOR 73, where 73 = 50 OR 33, where 50 = F0 & 55

49 = AA XOR E3, where E3 = C3 OR A0, and where C3 = F0 XOR 33, and A0 = F0 & AA

0F = trivial case, a boolean variable.

96 = CC XOR 5A, where 5A = F0 XOR AA

35 = C0 XOR F5, where C0 = F0 & CC and where F5 = F0 OR 55

39 = CC XOR F5, where F5 = F0 OR 55

17 = C0 XOR D7, where C0 = F0 & CC and where D7 = C3 OR 55, and where C3 = F0 XOR 33

99 = CC XOR 55

These are 3-variable cases above.
Use a cube by folding the 2 by 4 Karnaugh map in half.
There are 22 shapes for 3 variables.

]]>
https://www.mathisfunforum.com/profile.php?id=220178 2019-07-21T19:57:43Z https://www.mathisfunforum.com/viewtopic.php?pid=410132#p410132
<![CDATA[Re: what is discrete math?]]> Also on the topic of discrete math for electronics is Karnaugh mapping created in 1950's.
And Logic Circuit Minimization.

]]>
https://www.mathisfunforum.com/profile.php?id=1108 2006-02-04T15:24:29Z https://www.mathisfunforum.com/viewtopic.php?pid=26447#p26447
<![CDATA[Re: what is discrete math?]]>
``````<?php
function canOpener (\$can)  {
\$canOpened = false;
\$args = func_get_args();
unset (\$args);  //that's \$can; we have that one

foreach (\$args as \$compareTo)  {
if (\$can == \$compareTo)  { \$canOpened = true; }
}

return \$canOpened;
}
?>`````` ]]>
https://www.mathisfunforum.com/profile.php?id=956 2006-02-03T21:03:26Z https://www.mathisfunforum.com/viewtopic.php?pid=26356#p26356
<![CDATA[Re: what is discrete math?]]>
``````canopener (\$problem) {
\$result = solved;
}``````
]]>
https://www.mathisfunforum.com/profile.php?id=2 2006-02-03T08:13:02Z https://www.mathisfunforum.com/viewtopic.php?pid=26341#p26341
<![CDATA[Re: what is discrete math?]]> Hmm...case true eh? Pretty slick. I had thought of the rollover switch, but it seems like using a sledgehammer to open a can. Almost easier to just use a knife. But what I really need is a can opener...

]]>
https://www.mathisfunforum.com/profile.php?id=956 2006-02-02T23:26:30Z https://www.mathisfunforum.com/viewtopic.php?pid=26284#p26284
<![CDATA[Re: what is discrete math?]]> ryos wrote:

OK. Too right. I still wish their were a language construct for compacting conditions wherein a variable could equal one of several things that trigger the condition.

Isn't that the "select" statement (aso called "case" or "switch") ?

Example (Visual Basic code to replace any non-alphanumeric with "_"):

``````    Select Case c
Case "a" To "z", "A" To "Z", "0" To "9"
Mid\$(x, i, 1) = c

Case Else
Mid\$(x, i, 1) = "_"

End Select``````

I chose VB because it has such a rich case statement, PHP can only have one value per "case":

``````    switch (\$MatchType) {
case "=":
\$s .= \$MatchVar . "=" . \$MatchVal;
break;

case "Like":
\$s .= \$MatchVar . ' like "%' . \$MatchVal . '%"';
break;

default:
\$s .= \$MatchVar . \$MatchVal; break;

}``````

But PHP, like C, will continue to run statements below it without the "break;", so this can be used to put several "case" statments in sequence:

``````    switch (\$MatchType) {
case "=":
case "equal":
case "same":
\$s .= \$MatchVar . "=" . \$MatchVal;
break;

case "Like":
\$s .= \$MatchVar . ' like "%' . \$MatchVal . '%"';
break;

default:
\$s .= \$MatchVar . \$MatchVal; break;

}``````

But there is a trick in PHP: use switch (TRUE) and then the "case"s can be conditions like "(\$x >5)" or "in_array()" etc.

Sorry, didn't mean to ramble on.

]]>
https://www.mathisfunforum.com/profile.php?id=2 2006-02-02T20:29:17Z https://www.mathisfunforum.com/viewtopic.php?pid=26267#p26267
<![CDATA[Re: what is discrete math?]]> maybe there is. Many computer languages hold secret techniques only known by the ninja's.

]]>
https://www.mathisfunforum.com/profile.php?id=1041 2006-02-02T18:22:04Z https://www.mathisfunforum.com/viewtopic.php?pid=26262#p26262
<![CDATA[Re: what is discrete math?]]> OK. Too right. I still wish their were a language construct for compacting conditions wherein a variable could equal one of several things that trigger the condition.

]]>
https://www.mathisfunforum.com/profile.php?id=956 2006-02-02T18:08:46Z https://www.mathisfunforum.com/viewtopic.php?pid=26261#p26261
<![CDATA[Re: what is discrete math?]]> Well in the case of C++, there are I believe three logical operators,  And "&&" Or, "||" and Not "!"

Really an if statement returns true if the statement is true, and false if the statement is false, but you can use simple values instead of relational opererators such as ==, >, <, etc. A variable with a value of  zero evaluates false. All others evaluate true.

If for instance you were to say:

if(5) { statement; }

it will evaluate true and always will since 5 does not equal zero, and the statement will be excecuted.

if(0) { statement; }

this will not be executed. Zero returns false.

When you use the logical operators,  you can use the "or" and "and" operaters to execute a statement if either, or only if both are true.

you could say

if(0 || 1) { statement; }

that would return true. ( "||" means or)

if (0 && 1) { statement; }

that would not return true since both must be true.

But when you say if ( x == (5 || 7)) { statement;}

I believe this is incorrect use of the or operator. The or operator is used between two expressions that are evaluated for their truth or falsity. Not their value.

]]>
https://www.mathisfunforum.com/profile.php?id=1041 2006-02-01T23:13:23Z https://www.mathisfunforum.com/viewtopic.php?pid=26188#p26188
<![CDATA[Re: what is discrete math?]]> Heh, I think exactly opposite. My first programming language was C at age 13. My first OOP language was Java at age 18. Both were very easy to learn, but using Java is much easier. This is mainly due to Java's memory handling and extensive API. And after using a language that abstracts strings, I just can't bring myself to use a language that doesn't (of course, I'm sure people have abstracted strings tons of times in C++, but I doubt it's as slick as native support).

I'm starting to learn Ruby, which is supposedly nice enough to make PHP blush with shame.

]]>
https://www.mathisfunforum.com/profile.php?id=956 2006-02-01T23:00:45Z https://www.mathisfunforum.com/viewtopic.php?pid=26187#p26187
<![CDATA[Re: what is discrete math?]]>

Why the heck is it 8 bits on some compilers? I thought the purpose was to save memory for switch variables. Peculiar...

This is a bit of a complex question (pun intended).  Computers run much faster if all data is stored in whole bytes.  To understand why, you need to understand the underlying architecture, which would take me a while to describe.

]]>
https://www.mathisfunforum.com/profile.php?id=2143 2006-02-01T22:59:13Z https://www.mathisfunforum.com/viewtopic.php?pid=26186#p26186