I am trying to understand with boolean algebra how using 4 NAND Gates can be equivalen to 1 XOR gate.
If we look at this picture from wikipedia http://en.wikipedia.org/wiki/XOR_gate#Alternatives
There is a schematic of the gate.
This is the large expression I came up with to express the schematic. Perhaps it is wrong and that may be my issue? But still I cannot see how to transform the equation into the XOR expression I expect.
I have: !X!Y + X(!X!Y) + Y(!X!Y) + XY(!X!Y)
I know XOR logic looks like this: X!Y + !XY.
Can anyone clear up my confusion?
Your translation of the schematic on Wikipedia is a little bit off. I translated it into
!(!(A!(AB))!(B!(AB)))
Notice that !(XY) and !X!Y are different and that the schematic does not have any or gates (so no + operators). From there we can simplify using various boolean logic:
(!(!(A!(AB))) + !(!(B!(AB))))
(A!(AB) + B!(AB))
(A(!A + !B) + B(!A + !B))
(A!B + B!A)
Related
The question should perhaps be why does (3*x + 1)^5 * (3*x - 1) / x^6 = (3 + 1/x)^5 * (3 - 1/x) evaluate to false in Maple, even with the assumption that x > 0. The same expression evaluates to true in Mathematica and, of course, the statement itself is mathematically true under the previous assumption.
Maple's help pages don't give any clue on why this happens, and I would like someone to explain this behaviour before I think that Maple's evalb() is kind of broken. It is the type of questions I'm asking myself lately, since I'm deciding wether I should learn Maple or rather drop it and focus on learning Mathematica.
Thank you in advance.
If both sides of the equation are of type numeric (or extended complex numeric, etc), then evalb will test the equality. But for your symbolic expressions the evalb command will only test that they are the very same expression (by comparing memory address).
But they are not the very same expression. They are merely two different symbolic expressions for which you wish to do a mathematical test of equivalence.
restart;
expr:=(3*x+1)^5*(3*x-1)/x^6=(3+1/x)^5*(3-1/x):
is(expr);
true
testeq(expr);
true
simplify((rhs-lhs)(expr));
0
I need to draw a logical circuit from a simplified boolean expression.
Here's the expression:
x = PQ'R' + PQ'R + PQR' + PQR
I got the simplified expression as x = P.
I need to draw the circuit from this simplified expression.
Now, my question is, how to draw the logical circuit when the simplified expression has only one variable?
Any help is appreciated. Thanks.
EDIT: I used AND gate and gave both input as P, so it will give the output P itself. Is it right?
this is circuit of 'x' that include 4 And gate with three input and 1 Or gate with four input
I'm working on some assignment and got to build few gates starting with only NAND gate.
At this moment I have already following: AND, NOT, NAND.
To build AND and NOT wasn't too diffucult since it was quite obvious how to manipulate NAND to get expected results just by looking at its truth table. However I already had feeling that I'm doing things not in the right way. Now I stuck on building OR gate since I'm not able to find any relationship when just looking in truth table.
I do not need just an answer rather explaination and methodology that I could apply in future when building other gates as well.
Thanks.
You have:
a + b
rewrite to
~~(a + b) // Invert twice
then use De Morgan's law (i.e. ~(X + Y) = ~X * ~Y ) and rewrite to
~(~a * ~b)
Now you can use the NOT you already have on both a and b and then followed by a NAND
Like:
BTW - free hand drawing in paint ain't easy :-)
Obviously ~X = X nand X. Now using De Morgan duality, we have
X or Y = ~(~X and ~Y) = (X nand X) nand (Y nand Y)
I received this question from my lecturer and i am stuck.
F=ca+b'a'
implement this function using no more than 3 H.A (half adder) and 3 NOT gates.
i succeed to get a'b' and ac
and still had 1 HA and 1 NOT gate.
I have difficulties creating the OR gate for those two.
Use De Morgan's law and convert the expression in the following form :- ((ca)'(b'a')')'. Assuming that complements of the Literals are available.
The actual implementation of the circuit.
So I'm completely new to MATLAB and I'm trying to understand colon notation within mathematical operations. So, in this book I found this statement:
w(1:5)=j(1:5) + k(1:5);
I do not understand what it really does. I know that w(1:5) is pretty much iterating through the w array from index 1 through 5, but in the statement above, shouldn't all indexes of w be equal to j(5) + k(5) in the end? Or am I completely wrong on how this works? It'd be awesome if someone posted the equivalent in Java to that up there. Thanks in advance :-)
I am pretty sure this means
"The first 5 elements of w shall be the first 5 elements of j + the first 5 elements of k" (I am not sure if matlab arrays start with 0 or 1 though)
So:
w1 = j1+k1
w2 = j2+k2
w3 = j3+k3
w4 = j4+k4
w5 = j5+k5
Think "Vector addition" here.
w(1:5)=j(1:5) + k(1:5);
is the same that:
for i=1:5
w(i)=j(i)+k(i);
end
MATLAB uses vectors and matrices, and is heavily optimized to handle operations on them efficiently.
The expression w(1:5) means a vector consisting of the first 5 elements of w; the expression you posted adds two 5 element vectors (the first 5 elements of j and k) and assigns the result to the first five elements of w.
I think your problem comes from the way how do you call this statement. It is not an iteration, but rather simple assignment. Now we only need to understand what was assigned to what.
I will assume j,k, w are all vectors 1 by N.
j(1:5) - means elements from 1 to 5 of the vector j
j(1:5) + k(1:5) - will result in elementwise sum of both operands
w(1:5) = ... - will assign the result again elementwise to w
Writing your code using colon notation makes it less verbose and more efficient. So it is highly recommended to do so. Also, colon notation is the basic and very powerful feature of MATLAB. Make sure you understand it well, before you move on. MATLAB is very well documented so you can read on this topic here.