Name of axiom that tells you that (A OR B) is NOT(NOT A AND NOT B) [closed] - boolean-logic

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 7 years ago.
Improve this question
I'm having a mental block here.
What is the name of the axiom / theorem that tells you that
(A OR B) == NOT(NOT A AND NOT B)
I'm about to review some C code and can't remember that this is called.

It is the De Morgan's law. It's usually expressed as
"not (A and B)" is the same as "(not A) or (not B)"
or
"not (A or B)" is the same as "(not A) and (not B)"

Related

Prove that not all ternary linear codes contain the all zero codeword [closed]

Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 days ago.
Improve this question
I have to prove that not all ternary linear codes contain the all zero codeword.
Some term explanations:
A linear code is a code that the sum or difference of any two codewords must also be a codeword. In other words, for all x, y in C, x +/- y is also in C.
A ternary codeword in this exercise is a codeword containing 0, 1 or 2. Eg, 1011, 1012, 012, ...
An all zero codeword is something like 0000, 000, 00000, ...
My attempt:
The addition of codewords must be done MOD 3 which means there are three allowable numbers in this MOD 3 world including 0, 1 and 2. For any ternary linear codes, there are cases when all the additions of any two codewords yeild non-zero codewords.
I am not sure about the proof. I have an idea that it must deal with the MOD 3 but not sure how to explain.
Thank you so much!

Shaping theorem for MDPs [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 last year.
Improve this question
I need help with understanding the shaping theorem for MDPs. Here's the relevant paper: https://people.eecs.berkeley.edu/~pabbeel/cs287-fa09/readings/NgHaradaRussell-shaping-ICML1999.pdf it basically says that a markov decision process that has some reward function on transitions between states and actions R(s, a, s') has the same optimal policy as a different markov decision process with it's reward defined as R'(s, a, s') = R(s, a, s') + gamma*f(s') - f(s), where gamma is the time-discount-rate.
I understand the proof, but it seems like a trivial case where it breaks down is when R(s, a, s') = 0 for all states and actions, and the agent is faced with the path A -> s -> B versus A -> r -> t -> B. With the original markov process we get an EV of 0 for both paths, so both paths are optimal. But with the potential added to each transition we get, gamma^2*f(B)-f(A) for the first path, and gamma^3*f(B) - f(A) for the second. So if gamma < 1, and 0 < f(B), f(A), then the second path is no longer optimal.
Am I misunderstanding the theorem, or am I making some other mistake?
You are missing the assumption that for every terminal, and starting state s_T, s_0 we have f(s_T) = f(s_0) = 0. (Note, that in the paper there is an assumption that after terminal state there is always the new starting state, and the potential "wraps around).

function in Haskell that can solve an equation [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 8 years ago.
Improve this question
I need to write a function in Haskell that can solve the following problem(physic_problem):
What is the height (in a whole number of meters) of the shortest building that you could drop a ball from such that it would take at least 5 seconds to hit the ground?
The equation can be found here http://en.wikipedia.org/wiki/Equations_for_a_falling_body
I really tried hard on this and i need help!
Thank you so much!
Consider for instance this,
g :: Double
g = 9.81
dist :: Double -> Double
dist t = g * t^2 / 2
Then,
> dist 5
122.625
Additionally you may want to create a module out of the equations in that Wiki.
Update
For delivering an integral value consider for example
dist' :: (Integral a) => Double -> a
dist' t = ceiling $ g * t^2 / 2
Here we use ceiling (upper bound), yet note Converting to Integral for other rounding functions. Hence,
> dist' 5
123

Haskell define a function [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 8 years ago.
Improve this question
I have to make a function like this:
success :: (Int,Int,Int) -> Int -> (Int,Int,Int) -> Bool
(Int,Int,Int) First three Ints are attributes (that means numbers from 1 to 20)
Int in the middle is the one to compare the differences between attributes and dices.
(Int,Int,Int) the last three Ints are diced by a dice with 20 sides for each of them.
sucess (attribute 1,attribute 2, attribute 3) -> Compare difference between attributes and dices -> (Dice 1,Dice 2,Dice 3) -> Bool
Now I have to compare attribute 1 and dice 1 and so on.
If the dice is higher then the attribute, I've to notice the difference.
If lower I've to notice 0. If the three differences are higher than the difficult I lose
=> function is false
For example:
success (16,13,8) 4 (1,17,10) => false difference is 6
success (16,13,8) 4 (1,10, 9) => true difference is only 1!
I am a newby at haskell-programming and have no idea how to handle this.
This looks like a homework assigment, you're supposed to do it by yourself. So I will offer some hints instead of the full working solution.
You could define that function by using pattern matching:
success (a1, a2, a3) d (d1, d2, d3) = ... -- put condition at here
where diff1 = ...
diff2 = ...
diff3 = ...
I believe you can fill in the missing details quite easily.

how to design grid and blocks in cuda fortran for a 3-d array [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
I am new to Cuda fortran. I have never worked with higher dimension grids. I just thought to start with this problem, in which i have to assign 1 thread to each cell of a 3-d array of size 46*46*19. Please can someone help me how to design the grid and blocks for this type of array and to compute the thread indices for that.
any help will be appreciated.
I have come up with this, but i don't know how to compute the thread indexes
type(dim3) :: threads,blocks
threads=dim3(16,16,4)
blocks=dim3((xDim + threads%x - 1)/threads%x,(yDim + threads%y - 1)/threads%y,(zDim + threads%z - 1)/threads%z)
The code you've shown in your question is what you would use to set up the kernel launch.
Inside the kernel you could use code like this to generate thread x,y, and z indices:
idx = (blockIdx%x-1) * blockDim%x + threadIdx%x-1
idy = (blockIdx%y-1) * blockDim%y + threadIdx%y-1
idz = (blockIdx%z-1) * blockDim%z + threadIdx%z-1
This would create zero-based indexing. You could omit the -1 at the end of each line of code above to create one-based indexing.