I have a problem with some homework, for my Advanced Digital Design course, in which I have to create the truth table and find the Boolean expression for a provided circuit (image is linked below). I was able to create the truth table and I think find the Boolean Expression for the problem using the truth table that I created, but I don't think that this is the way that we are supposed to find the Boolean Expression. I was hoping that someone could share some insight on how to find the Boolean Expression without using the truth table.
I would normally not have such an issue with this, but since there are 5 variables, and NAND gates, I am quite confused on how to simplify once I find it.
I think that the outcome is something like:
[(a(bcd)'e)']' when you look at the circuit, and not the table, but I am not entirely sure. I am also not sure on how to simplify this into a Boolean expression if this is right.
Using the truth table to find the minterms I get y= m17+m19+m21+m22+m23+m25+m29 (which I am also not sure if it is right). And if I use a K-Chart to solve this, I end up with y = ab'e + a'ce + ab'cd, which seems like a legitimate simplified Boolean expression, but I have no clue if that is right.
Since this question is worth 20 of the total 100 points, I could really use some help understanding how this works.
Here is the image we were provided:
Circuit: only circuit (a), not (b)
Thank you!
I think that the outcome is something like: [(a(bcd)'e)']'
Your first guess is correct.
You just have to remark that whatever''=whatever
f=[(a(bcd)'e)']' = a(bcd)'e
Using de Morgan (bcd)' = b'+c'+d'
Hence f=a(bcd)'e = ae(b'+c'+d') =ab'e + ac'e + ad'e
which is minimal.
Related
This has been bugging me since a long time.
Suppose I have a boolean function F defined as follows:
Now, it can be expressed in its SOP form as:
F = bar(X)Ybar(Z)+ XYZ
But I fail to understand why we always complement the 0s to express them as 1. Is it assumed that the inputs X, Y and Z will always be 1?
What is the practical application of that? All the youtube videos I watched on this topic, how to express a function in SOP form or as sum of minterms but none of them explained why we need this thing? Why do we need minterms in the first place?
As of now, I believe that we design circuits to yield and take only 1 and that's where minterms come in handy. But I couldn't get any confirmation of this thing anywhere so I am not sure I am right.
Maxterms are even more confusing. Do we design circuits that would yield and take only 0s? Is that the purpose of maxterms?
Why do we need minterms in the first place?
We do not need minterms, we need a way to solve a logic design problem, i.e. given a truth table, find a logic circuit able to reproduce this truth table.
Obviously, this requires a methodology. Minterm and sum-of-products is mean to realize that. Maxterms and product-of-sums is another one. In either case, you get an algebraic representation of your truth table and you can either implement it directly or try to apply standard theorems of boolean algebra to find an equivalent, but simpler, representation.
But these are not the only tools. For instance, with Karnaugh maps, you rewrite your truth table with some rules and you can simultaneously find an algebraic representation and reduce its complexity, and it does not consider minterms. Its main drawback is that it becomes unworkable if the number of inputs rises and it cannot be considered as a general way to solve the problem of logic design.
It happens that minterms (or maxterms) do not have this drawback, and can be used to solve any problem. We get a trut table and we can directly convert it in an equation with ands, ors and nots. Indeed minterms are somehow simpler to human beings than maxterms, but it is just a matter of taste or of a reduced number of parenthesis, they are actually equivalent.
But I fail to understand why we always complement the 0s to express them as 1. Is it assumed that the inputs X, Y and Z will always be 1?
Assume that we have a truth table, with only a given output at 1. For instance, as line 3 of your table. It means that when x=0, y=1 and z=0 , the output will be zero. So, can I express that in boolean logic? With the SOP methodology, we say that we want a solution for this problem that is an "and" of entries or of their complement. And obviously the solution is "x must be false and y must be true and z must be false" or "(not x) must be true and y must be true and (not z) must be true", hence the minterm /x.y./z. So complementing when we have a 0 and leaving unchanged when we have a 1 is way to find the equation that will be true when xyz=010
If I have another table with only one output at 1 (for instance line 8 of your table), we can find similarly that I can implement this TT with x.y.z.
Now if I have a TT with 2 lines at 1, one can use the property of OR gates and do the OR of the previous circuits. when the output of the first one is 1, it will force this behavior and ditto for the second. And we directly get the solution for your table /xy/z+xyz
This can be extended to any number of ones in the TT and gives a systematic way to find an equation equivalent to a truth table.
So just think of minterms and maxterms as a tool to translate a TT into equations. What is important is the truth table (that describes the behaviour of what you want to do) and the equations (that give you a way to realize it).
As part of a homework assignment I must simplify the following (where '=NOT, .=AND, +=OR)
((A.B)+(A.C)+(B.C)).(ABC)'
I'm obviously not looking for someone to give me any sort of solution. However, I think it would be immensely helpful if someone could demonstrate where and how I'm misapplying a Boolean law (my terms keep zeroing out which is not a possible answer). I'll start by rewriting the rightmost factor.
((A.B)+(A.C)+(B.C)).(A'.B'.C')
Distribute
(A'.B'.C')(A.B)+(A'.B'.C')(A.C)+(A'.B'.C')(B.C)
Distribute and simplify leftmost term (A'A = 0)
(A'(A.B)).(B'(A.B)).(C'(A.B))+(A'.B'.C')(A.C)+(A'.B'.C')(B.C)
((A'A).(A'B)).((B'A).(B'B)).((C'A).(C'B))+(rightside expression)
((0).(A'B)).((B'A).(0)).((C'A).(C'B))+(rightside)
(0).(0).((C'A).(C'B))+(rightside)
((0).((C'A).(C'B))+(rightside)
(0)+(rightside)
I've concluded so far that, since the other 'rightside' terms have a similar structure they will also zero out leaving me with 0+0+0 = 0. This cannot be correct since this equation is supposed to equate to another non-zero expression according to my assignment.
If you're curious my main resource for boolean laws is electronic tutorials
Can you point out my error(s)?
I have been struggling with some questions from my study guide and really am stuck - I have asked the lecturer for help but his answer was literally "but it's been done for you" (referring to gauss_seidel code that was written) - to which I think he missed the point. I'm struggling to understand the actual question and how to approach it.
The first question reads as follows:
Define the 100x100 square matrix A and the column vector b by:
A(ij)=I(ij)+1/((i-j)2+1) b_(i)=1+2/i 1<=i j<=100
where I_(ij) is the 100x100 identity matrix (i.e 1 on the main diagonal and 0 everywhere else). Solve for x using both the Gauss-Seidel method and the A\b construct.
We have written the code for the gauss_seidel method, and i think i understand what it does mostly, however, i do not understand how the above question fits into the method. I was thinking that i'm supposed to do something like the following in the octave window then calling the gauss_seidel method:
>> A=eye(100,100);
>> b= (this is where i get slightly confused)... I've tried doing
>> for b=1:n;
>> b=1+(2/n);
That is question 1.
Question 2 I have given an answer and asked him about but he has not responded.
It reads: The Hilbert matrix is a square n x n matrix defined by:
H_(ij)n = 1/i+j+1
Define bn to be a column vector of dimension n, and with each element 1. Construct bn and then solve for x, Hn xn=bn in the cases n=4.
What i did here was simply:
>> b=ones (4,1);
>> x=hilb(4)\b;
and then it gave me the output of x values. Im not sure if what i did here was correct... since it doesnt mention using any method at all it just says solve for x.
Im not sure how to relate the lecturers reply to understanding the problem.
If you could help me by maybe letting me know what im missing or how i should be thinking about this, it would really help.
the gauss_seidel code looks like this:
function xnew=gauss_seidel(A,b,xold)
n=size(A)(1);
At=A;
xnew=xold;
for k=1:n
At(k,k)=0;
end
for k=1:n
xnew(k)=(b(k)-At(k,:)*xnew)/A(k,k);
end
endfunction
Ive been writing pseudo since last Monday and I am only a little bit clearer on what the code does.
A(ij)=I(ij)+1/((i-j)2+1), b(i)=1+2/i, 1<=i, j<=100
All this is really saying is that we have to create A and b in such a way that i>=1 and j<=100. After doing that, you simply solve using the Gauss Seidel method.
So we'd create b like this:
b=zeros(100,1);
for k=1:100
b(k) = 1+(2/k);
end
This will create a column vector with a size of 100x1 with all the values that satisfy b(i)=1+2/i where i (or in the code,'k') was greater or equal to 1.
Then to create A :
myMatrix=zeros(100,100);
for i=1:100
for j=1:100
myMatrix(i,j) = 1/(((i-j)^2) + 1);
end
end
A=eye(100) + myMatrix;
Now we have created A in such a way that it equals A(ij)=I(ij)+1/((i-j)2+1) where i was greater or equal to 1 & j was less than or equal to 100.
The rest of the question is basically asking to to solve for the values of x using the Gauss Seidel method.
So it be something like this :
y=iterative_linear_solve(A,b,x0,TOL,max_it,method);
Don't forget about creating x0 as the initial assumption, tolerance and max iterations etc.
In terms of question 2, you did exactly what I would have done. I think you're good with that.
I'm not too sure how to answer this :
If you could help me by maybe letting me know what im missing or how i
should be thinking about this, it would really help.
All I can really say is that you need to look at the problems in such a way that you see Ax=b. For example in the first question we started by making b, and then A. After that we simply applied the A\b construct or the Gauss Seidel method and got our answer.
And that's essentially what you did for the second question.
Lastly, are you a UNISA student by chance? I am, haha. I've been struggling with this on my own for a while. The study guides don't seem to give a lot of info.
I usually try not ask for homework help but once again I am stuck. I've been going over and over my textbook but I am not able to figure this out. Emailed the instructor and all the help i get is "Check this page" and "check that page", so instead of just not doing it, I would like some advice so I am actually able to learn.
The "G" gate thing, is whats bugging me in the book there is no gate that looks like that so i have no idea what to do. Here's a picture of the question, basically I have to find the X values (outputs). The answer would be nice. But I highly would appreciate a little explaination of "why".
Really appreciate the help!
Ok, so you you're not quite sure what this G gate means from looking at the diagram. In a question like this (where there's something that doesn't make sense to you), it's helpful to start with what you do know.
From looking at the diagram I don't know what the G gate means. In fact I don't know anything about circuits (but I do know something about logic :) ). I start with the truth table that the author has generously given me the formulas for each gate. I notice that there are 3 operators (*,+,') which I know.
If you know what those operators mean, then you can derive the meaning of the G gate.
D looks like an AND
E looks like NAND, the nipple-ish thing is an inverter
F looks like NOT, a buffer with an inverter on the output
G looks like a NOR, an OR with inverted output
The unlabeled one looks like an OR.
That's a really bad drawing though.
Giving you the answer would only cheat you out of your education and this stuff is important. There are 16 logical connectives for binary functions and they're all . . . logical. They make sense.
AND means when both inputs are true the output will be true. "If A and B = 1 output is 1"
OR means if any of the inputs are true the output will be true. "if A or B = 1 output is 1"
NOT means if the input is true the output is false.
XOR means if either input is true, but not both, the output will be true. "If A or B = 1 output is 1 unless both A and B = 1"
AND, OR, and XOR can all have inverters on their outputs which reverses their meanings. When they're supposed to output true they'll output false and when they're supposed to output false they'll output true.
The headings in the table are using * to mean AND, + to mean OR, and ' to mean "invert the symbol on the left".
D is A AND B, so if A and B are true, then put a 1 in the column, the rest of the column is false.
E is B NAND C, so if B and C are true, then put a 0 in the column, the rest of the column is true.
F is NOT C, so put the opposite of C in the column.
G is NOT((A AND B) OR (NOT C)), or if you look at the schematic and think about the formulas a bit you'll see that it's NOT(D OR F). You should be able to figure this out on your own now.
X is G OR E, There's a more complicated formula for it that traces through the circuit like the formula for G, but if you need it to prove your work you'll have to talk to your teacher. You'll probably get more help asking questions that show you put in effort.
I wrote an article about Logical functions in JavaScript that includes schematics. If you memorize the function tables at the top of the article it'll help you a lot when dealing with digital logic. Bonus points for associating the function number with the function name, you'll have memorized the output column of the functions truth table. They've taught you to count in binary right? Anyway, here's the article: http://matthewkastor.blogspot.com/2013/10/logical-functions-in-javascript.html It's not so important for your immediate question but will definitely do you good to read it. Oh, inputs can be inverted as well so don't let that throw you off.
Given maths is not my strongest point I'm implementing a bezier curve for 3D animation.
The formula is shown here, and as you can see it is quite nasty. In my programming I use descriptive names, and like to break complex lines down to smaller manageable ones.
How is the best way to handle a scenario like this?
Is it to ignore programming best practices and stick with variable names such as x, y, and t?
In my opinion when you have a predefined mathematical equation it is perfectly acceptable to use short variable names: x, y, t, P_0 etc. which correspond to the equation. Make sure to reference the formula clearly though.
if the formulas is extrated to its own function i'd certainly use the canonical maths representation, and maybe add the wiki page url in a comment
if its imbedded in code with a specific usage of the function then keeping the domain names from your code might be better
it depends
Seeing as only the mathematician in you is actually going to understand the formula, my advice would be to go with a style that a mathematician would be most comfortable with (so letters as variables etc...)
I would also definitely put a comment in there somewhere that clearly states what the formula is, and what it does, for example "This method returns a series of points along a quadratic Bezier curve". That way whenever the programmer in you revisits the code you can safely ignore the mathematical complexity with the assumption that your inner mathematician has already checked to make sure its all ok.
I'd encourage you to use mathematic's best practices and denote variables with letters. Just provide explanation for the variables above the formula. And if you can split the formula to smaller subformulas, even better.
Don't bother. Just reference the documentation (the wikipedia page in this case or even better your own documentation) and make sure the variable names match your documentation. Code comments are just not well suited (nor need them to) describe mathematical formulation.
Sometimes a reference is better than 40 lines of comments or even suggestive variable names.
Make the formula in C# (or other language of preference) resemble the mathematical formula as closely as possible, and include a reference to the formula, including a description of the variables. The idea in coding is to be readable, and if you're dealing with mathematical formulae the most readable representation is the one that looks most like mathematics.
You could key the formula into wolfram alpha ... it will try to simplify for you.
It'll also output in a mathematica friendly style ... funnily enough ;)
Kindness,
Dan
I tend to break an equation down into its root parts.
def sum(array)
array.inject(0) { |result, item| result + item }
end
def average(array)
sum(array) / array.length
end
def sum_squared_error(array)
avg = average(array)
array.inject(0) { |result, item| result + (item - avg) ** 2 }
end
def variance(array)
sum_squared_error(array) / (array.length - 1)
end
def standard_deviation(array)
Math.sqrt(variance(array))
end
You might consider using a domain-specific language to handle this. Mathematica would allow you to write out the equation just as it appears in mathematical notion.
The more your final form resembles the original equation, the more maintainable it will be in the long run (otherwise you have to interpret the code every time you see it).