Boolean algebra minimization using NAND only - boolean

Can anyone explain how the boolean expression is simplified in the last step?
Original Question:
Realize X=a´b´d´+b´cd´+a´b´c+a´cd´+abc´+abd+bc´d+ac´d using
minimum number of 2-input NAND gates. Assume that double-rail inputs
are available. No gate may be used as a NOT.

So Finally I figured out the answer/logic behind the answer with the help of a friend.
Method 1:
Use distributive law followed by consensus theorem.
Method 2:
Use to simplified version of above:
xy + ~xz = (x+z)(~x + y)

[{(a+b) ⊕ (c+d')}' {(a'+b') ⊕ (c'+d)}']'
if only we could implement XNOR without using NAND as NOT..... sad

Related

Find out Lipschitz constant L

I have an assignment in which I have to prove that the largest Lipschitz constant L for enter image description here this function in the link is λmax(ATranspose*A).I would be very grateful to anyone who helps.Thank you in advance.
As a general rule for an non-analytic matrix A (i.e. you don't have a way to get that value via classic mathematical analysis), you want to use the Power Method.

Maxima simplify expression with diff

Let's assume a is a constant and x is my variable with respect to time, so basically x(t).
Then in Maxima , what is the best way to replace 'diff(a*x,t) with a*'diff(x,t) automatically without use subst command.
The reason I don't to use subst is that I have many variables and higher order derivatives. It is not efficient to use subst to replace all the occurrences.
Thanks.
UPDATE
I have tried with depends(x,t) command, but it only works with the simple case. Here is an minimal example of my situation.
depends([x,y],t);
eq1:diff(x,t)-b=c;
eq2:subst([x=a*y],eq1);
sol_dy=solve(eq2,diff(y,t))
Of course here a,b,c are constants and x, y are variables on t.
Maxima can not solve diff(y,t) directly. How do deal with it?
I see that 'diff(...) (i.e. derivative noun expression) isn't linear (doesn't distribute over + and doesn't factor out constants) but diff(...) (verb expression) is linear. That's a misfeature, at least.
I was going to suggest declare(nounify(diff), linear) but that makes derivatives come out as 0 in your example ... this is probably a bug, I'll have to think more about it.
Try ev(eq2, nouns); to re-evaluate the derivatives as verbs -- I think that should cause the constant to factor out.

MATLAB symbolic expression: How to force the answer to be sin(alpha)/alpha

syms x alpha
L =1;
cn = (1/2)*int(exp(-j*alpha*x),x,-L,L)
cn should be sin(alpha)/alpha.
But Matlab answer as follows:
cn =
(2^(1/2)*sin(alpha)*i)/(2*(alpha*i)^(1/2)*(alpha*(i/2))^(1/2))
With simplify or simple, I can not force cn = sin(alpha)/alpha. How to force it?
Thanks a lot for the help
If you use simplify(cn,'IgnoreAnalyticConstraints',true) you get the result you want. The documentation for the option says:
Apply purely algebraic simplifications to an expression. simplify can return simpler results for expressions for which it would return more complicated results otherwise. Setting IgnoreAnalyticConstraints to true can lead to results that are not equivalent to the initial expression.
I never saw the option returning "wrong" results. If you are interested in some further explanations you can read ths blog entry.

Prove NP-completeness of CLIQUE-OR-INDEPENDENT-SET

First of all, I want to mention that this is my homework. However, to solve my problem I can use any literature I want.
Even though I think that problem is clear from its name, I will give it description: "For given undirected graph G and given integer k, does G contain totally connected (clique) subgraph of size k or totally disconnected subgraph (independent set) of size k."
I know about polynomial reductions from 3-SAT to CLIQUE and from 3-SAT to INDEPENDENT-SET. (http://mlnotes.com/2013/04/29/npc.html) However, I have problem with this one because I cannot combine those two reductions. I also tried reduction from CLIQUE to CLIQUE-OR-INDEPENDENT-SET but without much success.
So I would really appreciate any hints!
Thanks in advance.
I found out reduction from problem INDEPENDENT-SET to CLIQUE-OR-INDEPENDENT-SET. All you need to do is to add n isolated vertices to graph G (which is an instance of INDEPENDENT-SET and has n vertices). Let call this newly created graph G' (instance of CLIQUE-OR-INDEPENDENT-SET). Then it is not hard to prove that G has k independent-set iff G' has n+k independent-set of clique (since, by construction, it cannot have n+kclique).

YALMIP is returning that a program is infeasible when it is not

I'm having a problem trying to use YALMIP; I suspect I'm doing something silly and I would greatly appreciate if someone pointed out what it is.
I'm trying to solve some SDPs. When I don't define an objective, YALMIP returns a solution (implying that the problem is feasible). However, when I attach an objective to it, YALMIP returns that the problem is infeasible, which has left me a bit perplexed.
Here's the code for the simplest SDP I could cook up in which the above happens. Declaring the variables and setting the constraints is as follows:
y = sdpvar(6,1);
M = sdpvar(3,3);
C = [0,0,0,0,0,0; 0,0,0,0,0,0; -2,0,1.8,0,2,1; 0,0,0,0,0,0; 1,0,-1,0,-1.2,0;
0,0,0,0,0,0;];
F = [C*y==0, y(6) == 1, M>=0];
F = [F,M(1,1) == y(1), M(2,1) == y(2), M(3,1) == y(3),...
M(2,2) == y(4), M(3,2) == y(5), M(3,3) == y(6)];
Now if I merely ask YALMIP to find a feasible solution with
solvesdp(F)
it returns
info: 'Successfully solved (LMILAB)'
problem: 0
and some feasible M and y (I've checked that they indeed are). However, if I append the objective "minimise y(3)" (or indeed any linear combination of the entries of y) with
solvesdp(F,y(3))
it returns that the problem is infeasible:
info: 'Infeasible problem (LMILAB)'
problem: 1
and y and M are full of "NaN" tokens.
Many thanks in advance.
LMILAB should not be used together with YALMIP.
http://users.isy.liu.se/johanl/yalmip/pmwiki.php?n=Solvers.LMILAB
The solver in LMILAB has many deficiencies, and one which becomes crucial here is the fact that the solver lacks support for inequalities. To circumvent this, YALMIP adds double-sided inequalities, which completely destroys the numerical procedures of LMILAB.
Install a more general (and modern) solver such as SeDuMi, SDPT3, or Mosek
http://users.isy.liu.se/johanl/yalmip/pmwiki.php?n=Category.SemidefiniteProgrammingSolver
BTW, you are redundantly defining additional variables y. No reason to have them as separate decision variables and then encode how they relate to M. Simply extract them
y = M(find(tril(ones(3))));