Rewrite an boolean expression with only XOR - logic

so I extracted this expression from the map of karnaugh( (A0A1B1')+(A0A1'B0')+(A1B0'B1')+(A0A1B0') ) And my question is how can I convert this expression to only xor.
I tried to find something like this but didnt find anything like this, only answers and I wanted to see the process so I Know how it works.

Related

Difference between N[CDF[NormalDistribution[m,s],x]] and CDF[NormalDistribution[m,s],x]?

I'm new to Mathematica and I am struggling with the following problem:
If I evaluate the expression N[CDF[NormalDistribution[m,s],x]] for m=12, s=25 and x=10, i get 0.468119 (=the value I would expect), however, if I evaluate the expression CDF[NormalDistribution[m,s],x] for the same x,m,s, i get 0.324195.
I checked the documentation for Mathematica and I cannot spot the difference except that N[..] returns the numerical value of the expression inside the brackets.
Any ideas? Perhaps its soo simple but i don't see it..
Thank you

Azure ADF expression that returns either an existing array, or an empty array, based on a bool

I have a boolean expression: equals(myStringValue, targetStringValue)
I have an array expression which might or might not be valid, depending on the boolean condition myArrayExpression.
I want to write:
if(
equals(myStringValue, targetStringValue),
myArrayExpression,
?????
)
where ????? is an expression that returns an empty array.
Naturally, this is an XY-problem.
I definitely want to know how to do this directly, because understanding how this language works well is important to me. But if you want to know about the XY problem, it's over here: Azure ADF GetMetadata childItems if folder might not exist
Defining an array variable, with no default value, and then referencing that does work.
But seems very sad - now we've got an extra variable floating around for no reason :(
You can use if (x, Y, skip(createArray(''), 1))

Treat # as text in ToExpression Mathematica

I have to run ToExpression["Test#test"] and I want to return test#test, but the
function always return Test[test].
I tried to Unprotect, Clear, ClearAll, Remove ["#"] or [#], but it doesn't work.
Any ideas?
Test#test and Test[test] are two different notations for the very same Mathematica expression. If you convert the string "Test#test" to a Mathematica expression, any information about how it was entered is lost---only the expression structure is retained.
You should tell us why you want to "return test#test", as you said. It seems to me you have some serious confusion about how Mathematica works. Just explain what you want to achieve.

Correct use of findall/3, especially the first template argument

i know there is a build-in function findall/3 in prolog,
and im trying to find the total numbers of hours(Thrs) and store them in a list, then sum the list up. but it doesnt work for me. here is my code:
totalLecHrs(LN,THrs) :-
lecturer(LN,LId),
findall(Thrs, lectureSegmentHrs(CC,LId,B,E,THrs),L),
sumList(L,Thrs).
could you tell me what's wrong with it? thanks a lot.
You need to use a "dummy" variable for Hours in the findall/3 subgoal. What you wrote uses THrs both as the return value for sumList/2 and as the variable to be listed in L by findall/3. Use X as the first argument of findall and in the corresponding subgoal lectureSegmentHrs/5 as the last argument.
It looks like the problem is that you're using the same variable (Thrs) twice for different things. However it's hard to tell as you've also used different capitalisation in different places. Change the findall line so that the initial variable has the same capitalisation in the lectureSegmentHrs call. Then use a different variable completely to get the final output value (ie the one that appears in sumList and in the return slot of the entire predicate).
You need to use a different variable because Prolog does not support variable reassignment. In a logical language, the notion of reassigning a variable is inherently impossible. Something like the following may seem sensible...
...
X = 10,
X = 11,
...
But you have to remember that , in Prolog is the conjunction operator. You're effectively telling Prolog to find a solution to your problem where X is both 10 and 11 at the same time. So it's obviously going to tell you that that can't be done.
Instead you have to just make up new variable names as you go along. Sometimes this does get a bit annoying but it's just goes with the territory of a logical languages.

Boolean Expression Evaluation

I have a string (R(46 - 9900)) AND ( NOT (R(48 - 9900))) where R denotes Range . If you evaluate the expression it results in R(46-47) , considering the logical operators (AND,NOT).
I have a requirement where I need to parse such a string and evaluate it to a correct result . I have to use C++ as a programming tool to achieve this result .
Can anyone suggest a few guide lines as to how do I proceed on this ?
I'm reposting Aftershock's answer to your question the first time you posted it, since it was a good answer and it didn't deserve to be deleted:
You have to write a small interpreter. There are many ways to do it . Here is one. Here is pattern for it: http://en.wikipedia.org/wiki/Interpreter_pattern
This can help too: http://ryanfarley.com/blog/archive/2004/08/19/966.aspx That is about the intersection of data ranges but the problem is similar.
You may also use an operator precedense parser: http://en.wikipedia.org/wiki/Operator-precedence_parser

Resources