Write logic gates from logic gate circuit [closed] - math

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 8 years ago.
Improve this question
Could someone please show me how to write the logic from this logic circuit?
Following you guys' explanation, I have these results, am I right:
The question is which one of a, b, c, d produces the same ouput as the first circuit. I don't see any similar results here, please illuminate me !

Start from the inputs:
The AND gate gets A and B as inputs, and the NOT gate gets B as its input. The outputs of these 2 are the inputs to the OR Gate.
Therefore let
Y = A AND B
and Z = (NOT B)
=> X = Y OR Z
=> X = (A AND B) OR (NOT B)
UPDATE
I think b is the right answer.

If you give names to the intermediate terms, e.g. S and T, where S is the output of the AND gate and T is the output of the inverter (NOT gate), then you can break it down as follows:
X = S | T ; final OR gate
S = A & B ; output of AND gate
T = ~B ; output of inverter (NOT gate)
X = (A & B) | ~B ; substitute above
Note that this is a poor example as the expression can be reduced to:
X = ~(~A & B)
which can be implemented with just two gates (a NAND and a NOT), or
X = A | ~B
which can also be implemented with two gates (an OR and a NOT).

Related

Hi, what does the following line in Julia do? Thank you [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 months ago.
Improve this question
H = H === nothing ? h : [H h]
#both matrices
The matrix H is being assigned a value based on a ternary operator, which takes the form a ? b : c. In this case, if H is nothing, it will made the same as h. Otherwise, it will be concatenated with h (as with hcat).
Note: When H === nothing, the code does not assign H the values of h, as has been suggested. Instead, H is a copy of h. For instance, if you change one of the elements in H, it will change an element in h, since they are the same matrix.
It may help to look at the documentation for arrays.
Suppose
H === nothing
evaluates to true, then H is assigned the value of h. If false, then H is assigned to a 1x2 matrix which has H as its first value and h as its second value.

Formula to find square root of a natural number using only addition and subtraction [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 4 years ago.
Improve this question
How to use only addition and subtraction to find out square root of a natural number?
Thanks.
[I have looked over the internet but i didn't find any content related to this problem.]
Explanation to my problem: I want to create a c function which will receive only a natural number and return square root of it.
You may say to use the "sqrt" function but i just thought of creating one which will utilize addition and subtraction operator to create the square root.
You don't have to write the program, just writing the formula for it will be just fine. Thanks.
Update: This question is not specifically about coding rather about mathematics.(I tagged "c" as it had some link but this question is NOT about coding.)
n2 is the equivalent of the sum of the n first odd numbers.
You can iterate over the n (consequently adding only the next odd number to the previously calculated sum) until the square is equal or exceeds your number.
k = 0
sum = 0
while sum < target:
k += 1
sum += 2k-1
if sum > target:
the target doesn't have integer root
else:
k is the square root
We can use the fact that (n+1)² = n² + 2n + 1.
def sqrt(n):
k = 0
s = 0
while s <= n:
s = s+k+k+1
k = k+1
return k-1
print (sqrt(0)) # 0^2
print (sqrt(1)) # 1^2
print (sqrt(2)) # (1.4142135623730951...)^2
print (sqrt(144)) # 12^2
print (sqrt(169)) # 13^2
print (sqrt(196)) # 14^2
print (sqrt(255)) # 15^2
print (sqrt(1000)) # (31.622776601683793...)^2
print (sqrt(2000)) # (44.721359549995796...)^2
UPD
Sorry, I thought you were asking for code :)

How to prove that "Total" is not recursive (decidable) [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 9 years ago.
Improve this question
Halt = { f,x | f(x)↓ } is re (semi-decidable) but undecidable
Total = { f | ∀x f(x)↓ } is non-re (not even semi-decidable)
I need some help in proving that the Total problem is not recursive (decidable).
I know the diagonalization proof for the Halting problem, I just need the same kind of proof for the Total problem. I'm posting the Halting Problem Proof for reference:
Halting Problem Proof
Assume we can decide the halting problem. Then there exists some total function Halt such
that
1 if [x] (y) is defined
Halt(x,y) =
0 if [x] (y) is not defined
Here, we have numbered all programs and [x] refers to the x-th program in this ordering. We
can view Halt as a mapping from ℵ into ℵ by treating its input as a single number
representing the pairing of two numbers via the one-one onto function
pair(x,y) = <x,y> = 2^x (2y + 1) – 1
with inverses
<z>1 = exp(z+1,1)
<z>2 = ((( z + 1 ) // 2^<z>1) – 1 ) // 2
Now if Halt exist, then so does Disagree, where
0 if Halt(x,x) = 0, i.e, if Φx (x) is not defined
Disagree(x) =
µy (y == y+1) if Halt(x,x) = 1, i.e, if Φx (x) is defined
Since Disagree is a program from ℵ into ℵ , Disagree can be reasoned about by Halt. Let d
be such that Disagree = Φd, then
Disagree(d) is defined ⇔ Halt(d,d) = 0 ⇔ Φd (d) is undefined ⇔ Disagree(d) is undefined
But this means that Disagree contradicts its own existence. Since every step we took was
constructive, except for the original assumption, we must presume that the original assumption was in error. Thus, the Halting Problem is not solvable.

Convert one modulus value to other [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 9 years ago.
Improve this question
Given N = A%B, how to find the value of A%C , where B > C.
You are given value of N and C, but not of A.
Is there any way to find this?
Nope. Consider the following:
A = 19
B = 10
C = 7
==> Given 9, you should get 5.
A = 29
B = 10
C = 7
==> Given 9, you should get 1.
So given the same input, there may be multiple answers.
The modulo operation is one-way: given a mod b = n, all I can say is that a comes from the set of all other integers which, modulo b, equal n.
Let's demonstrate that this is impossible in general, taking B=3, C=2.
n = a mod 3 = 1
=> a is in the set of integers {3x + 1}
so consider, x=1
4 mod 3 = 1, so that works
4 mod 2 = 0
now consider x=2
7 mod 3 = 1, so we can't distinguish 4 from 7 knowing only n and b
7 mod 2 = 1
That is, given b=3 and n=1, you'd have to get two different answers without knowing a.
However, you may consider it's a special case that b and c here are coprime, and in fact are both prime. You can certainly solve this easily for some cases, such as b=4 and c=2.
BTW, further discussion on this is probably better suited to mathoverflow

What is the meaning of ∃? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
Reading a book on algorithms. Can someone explain the meaning of the mathematical symbol ∃?
It is called a quantifier. It means "there exists".
When used in an expression such as
∃x s.t. x > 0
It means "There exists a number x such that x is greater than 0."
Its counterpart is ∀, which means "for all". It's used like this:
∀x, x > 0
Which means "For any number x, it is greater than 0."
It is the "existential quantifier" as opposed to the upside-down A (∀) which means "universal quantifier." It should be read as "there exists" or "for some". It is a predication that means that some relation or property holds true for at least one object in the domain.
Examples:
An integer n is composite if ∃ integer m such that m > 1 and m < n with n divisible by m.
An integer n is prime if ∀ integer m such that m > 1 and m < n it is true that n is not divisible by m.
A function f is continuous on a metric space (X, d) if ∀x∀ε>0∃δ>0 | ∀y d(x, y) < δ => d(f(x), f(y)) < ε
More Info on Predicate Logic
It is called existential quantifier and being followed by x, it means there exists at least one x
For future reference, wikipedia has a table of mathematical symbols, with an explanation of the meaning(s) of each one.

Resources