Need help have no idea the thought process in doing this kind of simplification.
! - Denotes NOT
Lets say I have !((A+B) * (A+!B)) I need to simplify that using all rules except absortion.
I know it is A * !B + !A * B but I need to know the process to get there. What is a good place to start. I do several different things but I never come up with the right answer.
As a process of simplification use De Morgan's Law to move the NOT operator into the parenthesis.
So it would be
!((A+B) * (A+!B)) = !(A+B) + !(A+!B)
The next step (again use De Morgan's Law) after this would lead to your answer.
I hope this helps.
cheers
Karnaugh maps should be a good start.
Try repeating applications of DeMorgan's Law.
Re: "What is a good place to start" - use a reference for boolean laws. Here is one that I found: http://www.laynetworks.com/Boolean%20Algebra.htm
Look through the laws and see which ones can be applied; then pick the one that looks most like it is a step in the right direction.
With practice you will learn to be able to intuit the right laws to select; in the meantime you will need to hunt and peck a little.
Related
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.
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)?
There's a computer science term for this that escapes my head, one of those words that ends with "-icity".
It means something like a given action will always produce the same result, IE there won't be any hysteresis, or the action will not alter the functioning of the system...
Ring a bell, anyone? Thanks.
Apologies for the tagging, I'm only tagging it Java b/c I learned about this in a Java class back in school and I figure that crowd tends to have more CS background...
This could mean two different things:
deterministic - meaning that given the same initial state, the same operation (with exactly the same data) will always produce the same resulting state (and optional output.) - http://en.wikipedia.org/wiki/Deterministic_algorithm
i.e. same action has the same effect - assuming you start from the same place in the same system. (Nothing random about it, nothing fed in from the outside that could effect the result...)
idempotent - meaning applying a function to a value once e.g. f(x) = v produces the same result as applying the function multiple times e.g. f(f(f(x))) = v - http://en.wikipedia.org/wiki/Idempotence
i.e. one or more function applications yields the same value given the same initial value
you mean idempotent ??
Referential transparency is also used in some CS circles.
Nullipotent?
deterministic ,.,-=
Are you looking for invariant?
http://en.wikipedia.org/wiki/Invariant_%28computer_science%29
In computer science, a predicate is
called an invariant to a sequence of
operations if the predicate always
evaluates at the end of the sequence
to the same value as before starting
the sequence.
side effect-free?
In math, a function 'f' is idempotent if multiple applications do not change the result.
you mean idempotence?
or the action will not alter the functioning of the system...
Are you looking for ‘idempotence’?
The "ends with -icity" part of your question makes me think you might be looking for monotonicity, even though it does not quite match description/definition of the word. From the Wikipedia article:
In mathematics, a monotonic function (or monotone function) is a function which preserves the given order. This concept first arose in calculus, and was later generalized to the more abstract setting of order theory.
In the following illustrations (also borrowed from the Wikipedia article) three functions are drawn:
A:
B:
C:
A and B and both monotonic (increasing and decreasing respectively), while C is not monotonic.
You mean an atomic block of code?
The A in ACID.
Atomicity - states that database modifications must follow an “all or nothing” rule. Each transaction is said to be “atomic.” If one part of the transaction fails, the entire transaction fails.
It sounds like what you're describing would be a memoryless function. Although the term memorylessness is usually used for stochastic distributions, I don't quite remember if it has a programming equivalent...
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).
I have to do some work with Q Learning, about a guy that has to move furniture around a house (it's basically that). If the house is small enough, I can just have a matrix that represents actions/rewards, but as the house size grows bigger that will not be enough. So I have to use some kind of generalization function for it, instead. My teacher suggests I use not just one, but several ones, so I could compare them and so. What you guys recommend?
I heard that for this situation people are using Support Vector Machines, also Neural Networks. I'm not really inside the field so I can't tell. I had in the past some experience with Neural Networks, but SVM seem a lot harder subject to grasp. Are there any other methods that I should look for? I know there must be like a zillion of them, but I need something just to start.
Thanks
Just as a refresher of terminology, in Q-learning, you are trying to learn the Q-functions, which depend on the state and action:
Q(S,A) = ????
The standard version of Q-learning as taught in most classes tells you that you for each S and A, you need to learn a separate value in a table and tells you how to perform Bellman updates in order to converge to the optimal values.
Now, lets say that instead of table you use a different function approximator. For example, lets try linear functions. Take your (S,A) pair and think of a bunch of features you can extract from them. One example of a feature is "Am I next to a wall," another is "Will the action place the object next to a wall," etc. Number these features f1(S,A), f2(S,A), ...
Now, try to learn the Q function as a linear function of those features
Q(S,A) = w1 * f1(S,A) + w2*f2(S,A) ... + wN*fN(S,A)
How should you learn the weights w? Well, since this is a homework, I'll let you think about it on your own.
However, as a hint, lets say that you have K possible states and M possible actions in each state. Lets say you define K*M features, each of which is an indicator of whether you are in a particular state and are going to take a particular action. So
Q(S,A) = w11 * (S==1 && A == 1) + w12 * (S == 1 && A == 2) + w21 * (S==2 && A==3) ...
Now, notice that for any state/action pair, only one feature will be 1 and the rest will be 0, so Q(S,A) will be equal to the corresponding w and you are essentially learning a table. So, you can think of the standard, table Q-learning as a special case of learning with these linear functions. So, think of what the normal Q-learning algorithm does, and what you should do.
Hopefully you can find a small basis of features, much fewer than K*M, that will allow you to represent your space well.