# Tagged Questions

Questions on the functionality of Mathematica for Boolean computation.

181 views

### Importing an array from text file and convert it to truth table

I am new to Mathematica, and would like some help in the following operation. I have a truth table stored in a text file. I want to read this in Mathematica, and find its Boolean Rule. Suppose I have ...
61 views

### Solving at zeroes of a matrix - code only works for simple equation

I have a matrix of zeroes (True) and non-zeroes (False). The matrix is generated from a table of values of two other variables. I'm trying to observe how the solution for p3 changes with small ...
148 views

### Given a system of inequalities, how to make Solve find out that two variables should be equal?

Given two boolean variables x1 and x2 (in the sense that they are in the range [0,1]), if I try to solve the following equation system with Solve: ...
157 views

### Binary decision diagrams (BDD)

I would like to use Mathematica to help me simplify a given Binary Decision Diagram (i.e. pick the optimal variable ordering). I don't seem to find anything at all on the topic, although it is ...
127 views

### 3D Contour Plot - parts with gradients less and more than zero

I'm trying to plot sections of the 3D Contours, with gradient less than zero, and more than zero and equal to zero. It manages to solve for the derivative, but when I apply the conditions ...
207 views

### 3D Contour Plot parts of sphere with gradient less than 0, equal to 0 and more than 0

I want to plot only parts of the sphere of radius 1 where the gradient $\frac{\partial z}{\partial x}$ is < 0, = 0 and > 0. The full sphere is given by: ...
86 views

### Numbering of cases implied by a subset of Boolean vectors

In the course of a programming problem I stumbled upon the following sub-problem. Given an arbitrary, but fixed, number of Boolean variables, I would like to be able to pick a subset of the ...
113 views

### Is there an equivalent of Sum for And?

Is there an equivalent to Sum for And? That is, just like instead of ...
64 views

### If statements with a Boolean [duplicate]

If I have a vector {1,2,3}, I want to write an If statement, where if one of the positions is "1", it will perform a certain command. ...
532 views

### Converting truth tables to boolean expressions

I have a truth table for a Boolean expression represented like this ...
74 views

### Alternative to xor(A,B,C) [closed]

How can we make a comprehensive statement, which will correspond to the truth table of xor (A, B, C) (means that only true if exactly one of A,B,C is true) by combining logical operators AND (&), ...
183 views

### Conditional Check on Matrix

Suppose I have the following matrix (i,j): ...
81 views

### Expressions with Boolean variables and simplification

I have some familiarity with Mathematica, but have no experience with any Boolean computation. Suppose we have the Boolean formula $(x_1 \lor x_2) \land (x_2 \lor x_3)$. This can be simplified by ...
192 views

### Using Boole to integrate over region

I have a complex and long piecewise function to integrate, so I have written a Mathematica script that cuts the whole range of integration, evaluates the integrand in each region and then integrates ...
348 views

### Fast method for combining two lists

I have two lists, v1 and v2. Each element of the lists may be positive or negative. I want to create a list ...
293 views

### How to generate the truth table to prove logical equivalence?

How to generate the truth table to show that $p \implies (q \vee r)$ is equivalent to $(p \wedge \neg q ) \implies r$ ? Can I use BooleanTable?
148 views

### NIntegrate using Boole doesn't work

This doesn't want to work for me - I don't know why not. It usually gives me 0, but sometimes also a different number. I know it should be a small, non-zero number. ...
243 views

### Matlab-style Find in Mathematica? Value list and Boolean List, how to select values according to the boolean list?

I want to select elements with the true value (Indices list) in the corresponding point to the value list (MCS). Is there anything like Matlab-style Find to get the indices of true values in the ...
78 views

### How to negate a boolean vector?

The !True returns False but how can I negate a boolean vector such as {True, False, True}? ...
127 views

### How to add variables to boolean expression and get conjunctive normal form?

I have the boolean expression (a && !b). I want to add variables c, d into the ...
109 views

### Replace !x with x != 1

I have some logical relationships that I ultimately want to pass to NMaximize as constraints: ...
201 views

### Given a Boolean representation of a system, how can the Reliability Function be displayed as symbolic algebra?

Can Mathematica 9 convert a Boolean representation of an RBD to its symbolic algebraic form? If I have a simple series Reliability Block Diagram made up of 2 components, c1 and c2 bexpr1=And[c1,c2] ...
138 views

### Short circuit logical operators [duplicate]

Suppose I want to compute $f(1)\vee f(2) \vee \ldots \vee f(10^{10})$, but I know a priori that $f(n)$ is True for some $n \ll 10^{10}$ with high probability. For ...
138 views

### Conditionals slower than operators?

I want to make my application faster. I tried to replace an If condition with operators. The If condition is ...
208 views

### How to rewrite this function to be faster: Find sub-matrixes of boolean board which imply a given boolean pattern

I have Boolean matrix A (called "board") and Boolean matrix B with smaller dimensions (called "pattern"). I am trying to find sub-matrixes C of A such that C has same dimensions as B, and ...
125 views

### Defining an Implies operation that works for Boolean matrices

I have two Boolean matrices, that both have dimensions m x n. I want to create a function TableImplies, which would return True ...
105 views

### “And” to continue evaluation after “False”

Below, is it possible to print No and have x be 2. That is, I'm looking for an And-like function that looks at all arguments ...
166 views

### Sequence and boolean And

I'm trying to figure out if a calculation result it's a valid result. As it return a matrix, I need to test that every element it's a number, so I thought this could work... ...
650 views

### Simplify assumes Boolean 1 and 0 in logical expressions

Per this chat discussion and this previous question where I encountered the strange behaviour: ...
281 views

### Bit Operations — Force Binary Bit Representation

How to force binary bit representation of a number, so BitNot does yield the 1s-complement? BitNot[n] turns ones into zeros and vice versa in the binary bit representation of n. I was unable so ...
372 views

### Bitwise operators - Hamlet for Mathematica

What is the best way to check this famous equation: 0x2b || ~0x2b == 0xff Mathematica doesn't seem to have a handy bitwise negation operator. The best thing I ...
202 views

### Convert boolean test function to pattern?

What is a "reverse" to MatchQ? MatchQ converts pattern into boolean function. So how to convert back? Suppose I want to use ...
329 views

### Creating a Specific Boolean Function

How can I implement a Boolean function F(A,B) that has outputs that are not specific and, therefore, the truth table output of this two-input function will be (a, b, c, d) -- here the first term ...
327 views

### Plotting Fresnel function

I am trying to plot the partial sums and the cesaro means of the function $\sqrt{|x|}$ and for $a_{n}$, I obtained the following code which contains FresnelS. ...
571 views

### How to solve the liar problem?

In an island live two kinds of people: liar and truth-teller, the former only tells lies and the latter only tells truth, now there're two men A and B from the island, A said: "B is a truth-teller." B ...
887 views

### Implementation of a new Game of Life Rule

I need to implement a new "game of life" in Mathematica: I have three states — black, red and white. Black means go forward, red go back and white take no action. I would like to implement the ...
582 views

### Applying And to lists of Booleans

I'd like to take {True,True,False} and {True,False,False} and apply And to get ...
155 views

### How to get the boolean value of an inequality involving an InterpolatingFunction?

Here's the code: yan = FunctionInterpolation[x^2, {x, -1, 1}]; FullSimplify[yan[x] > -1, -1 < x < 1] Needless to say, what I expect to see in the output ...
165 views

### boolean return value in mathematica

why does the following instruction ok in mathematica, and it returns a boolean value In[398]:= catenary[x, 1, 0, 0] == catenary[-x, 1, 0, 0] Out[398]:= True and ...
1k views

### Are there “All” and “Any” functions in Mathematica?

In Python, there is a function all which returns true if all of its arguments are true, and any which returns true if at least ...