How to create a circuit that outputs only 1, regardless of inputs - binary

So this is the truth table:
In_1 In_2 In_3 Out
0 0 0 1
0 0 1 1
0 1 0 1
0 1 1 1
1 0 0 1
1 0 1 1
1 1 0 1
1 1 1 1
How do I create a circuit that matches this truth table?
Here is what I have tried, but this did not work:
Please help would be appreciated.

You just need to connect the output to a constant logic 1, which is usually just the power supply voltage. This is a trivial logic function and requires no gates to implement.

The solution is to apply Kmap. We will be ending up with an equation that will be similar to
but this is not the reduced form. If we try to reduce this equation we will end up with 1.
Check this tool for better understanding.
https://www.boolean-algebra.com/kmap/

Related

How do I create a circuit based on this truth table?

So this is the truth table
In_1 In_2 In_3 Out
0 0 0 0
0 0 1 1
0 1 0 1
0 1 1 1
1 0 0 1
1 0 1 1
1 1 0 1
1 1 1 0
I would like to create a circuit based on this truth table.
This is what I have tried, but failed
A Karnaugh map as suggested by paddy, will give you a set of minterms which fulfil the expression. That is the classical way to tackle such problems.
By inspection of the truth-table you can convince yourself, that the output is true whenever In_1 is unequal In_3 or In_1 is unequal In_2:
f = (In_1 xor In_2) or (In_1 xor In_3)

mysql query to calculate values local to Cartesian products of logical groups of rows

I'm trying to write a query to process a single table that looks like this:
record_id item_id part_id part_length
----------- ------- -------- ------------
1 0 0 123.12
2 0 0 123.09
3 0 1 231.24
4 0 1 239.14
5 1 0 45.91
6 1 0 46.12
7 1 1 62.24
8 1 1 59.40
which is basically a table of inaccurate length measurements of some parts of some items recorded multiple times (not twice, actually each part has 100s of measurements). With a single select, I want to get a result like this:
record_id item_id part_id unit part_length_ratio
----------- ------- -------- ----- ----------------
1 0 0 1 123.12 / 231.24
2 0 0 1 123.09 / 239.14
3 0 1 0 231.24 / 123.12
4 0 1 0 239.14 / 123.09
5 1 0 1 45.91 / 62.24
6 1 0 1 46.12 / 59.40
7 1 1 0 62.24 / 45.91
8 1 1 0 59.40 / 46.12
which is basically selecting each part of an item as the unit and calculates the ratio of the length of other parts of the same item to this unit while matching the measurement times. I wrote a script which computes this kind of table but would like to do it with sql. I can understand if you fail to understand the question :)
for each item i
for each part unit of i
for each part other of i
if unit != other
print i.id other.part_id unit.part_id other.length / unit.length
As I said in a comment, tables are unordered sets: there is no first or second row...
... unless if you want to use the id column to explicitly order the rows.
However, can you guarantee that there will always be (exactly) two samples for each case and that the "lower ID" always match the first sample? This appears to be quite fragile as in real-life, there will probably have cases where a test will be performed twice or a test will be missing or done "late". Not mentioning concurrent access to your DB.
Can't you simply add a "sample number" column?

Kind of logical subtraction

Having these two bitsets as an example:
1 1 0 0
1 0 0 1
How can I get this following result:
0 1 0 0
From my point of view this kind of logic operation must be a subtraction but omitting the borrow bit.
Is it possible to have a simple logical operation to get that result?
Thanks in advance.
it is only true, if A is true and B is false.
So it can be solved as A & ~B

Method for constructing a gate

I'm trying to construct a multiplex gate. It has two inputs, and one selector. I got as far as
the truth table.
A | B | Sel | Out
0 0 1 0
0 1 1 0
1 0 1 1
1 1 1 1
0 0 0 0
0 1 0 1
1 0 0 0
1 1 0 1
And this is where my method fails. I've constructed simpler gates such as AND, and OR. Those were so simple I didn't need an articulate method. I went to wikipedia to see if I could get
a method. Instead I only discovered which gates I need to construct the circuit. For my goals, this misses the point. More important to me is the method that arrives at the answer, rather than the answer itself. I know I need to use DeMorgan's Laws, but fall down when trying to come up with specifics. Any hints would be most welcome.
Just to elaborate on Keith's answer, here's the Karnaugh map for your truth table:
AB
00 01 11 10
___________
sel 0 | 0 1 1 0
1 | 0 0 1 1
This is created by grouping A and B, and then making a matrix of the outputs for any given input. Note the column headings do not count in binary, rather they are more like a grey code, having only one transition between each column.
Now that's done, you can write an equation that ORs together terms that cover all the 1s in the Karnaugh map.
On the Karnaugh map, it's pretty easy to see terms that cover multiple 1s. For example, the term B.sel' (B and not sel) covers both the 1's in the top row.
That combined with A.sel for the 1's in the bottom row gives the equation
output = B.sel' + A.sel
This works out at 4 gates, including the NOT.
You can make a Karnaugh Map, which will help you pick the gates you need to implement your function.

Boolean Logic and Truth Tables Explanation

I'm needing to create a truth table, and I really need to find a resource to explain how it works. I'll give an example of a problem.
I have to create a truth table based on this: A*(B+AB)=AB
So the truth table looks something like:
0 0
0 1
1 0
1 1 for A*(B+AB)=AB
How do I even begin to solve this? Are there any good resources that give a good explanation on what to do?
Ok So I then did one more complicated that involves a NOT.
! indicates not
!(A*!B+!AB) = AB+!(A+B)
So I did C = A*!B D=!A*B then !(C+D) for the left side. My final answer for that side is
0 0 1
0 1 0
1 0 0
0 0 1
So the right side is this
C = A * B D = A + B then C + !D
so that looked like this
0 0 1
0 1 0
0 1 0
1 1 1
I think I'm getting it? :)
Edit: I put in some extra explanation given your comment (which is now deleted).
A and B are two boolean variables. For example, in a program, A might be firstTestOK and B might be secondTestOK. Each of A and B can be either true (1) or false (0).
A+B means A or B which is true if either A or B is true. A*B means A and B is is true only if both A and B are true.
All of the combinations for A, B are:
A is false and B is false
A is false and B is true
A is true and B is false
A is true and B is true
This can be written more compactly as a truth table as follows:
A B
0 0
0 1
1 0
1 1
What you've been asked to do is show A*(B+AB) is the same as AB. So, for each combination, we work out the left-hand-side, which is A*(B+AB) and the right-hand-side, which is AB:
A B C=A*B D=B+C A*D = A*B
0 0 0 0 0 0
0 1 0 1 0 0
1 0 0 0 0 0
1 1 1 1 1 1
so, looking at all of the combinations in the last two columns, we see that the results are the same, so AD=A(B+AB) is AB.
Since the left-hand-side is a little complicated, I did it in steps by breaking it up into pieces, by introducing C and D.