1,930 questions
4
votes
2
answers
116
views
How to reduce multivariate boolean expressions
I need to model a system of several boolean expressions in 512 variables. Due to the number of variables, I found the expressions are way too large to handle normally, which is why I need a way to ...
5
votes
2
answers
189
views
How does the `(…) and (…) or (…)` idiom mimic a ternary operator in Lua?
This statement mimics a ternary operator in the Lua programing language:
local result = condition and true_value or false_value
But how does it work? Why does it give true_value if the condition is ...
4
votes
2
answers
500
views
Check if all values of Polars DataFrame are True
How can I check if all values of a polars DataFrame, containing only boolean columns, are True?
Example df:
df = pl.DataFrame({"a": [True, True, None],
"b": [...
0
votes
1
answer
45
views
Troubleshooting of Boolean combination of AND and OR conditions in Excel Formula [duplicate]
I am trying to set up an Excel conditional formula with both AND and OR criteria.
However, the last 2 criteria OR(Table1[Col5]=$J$4,Table1[Col5]=$K$4) and OR(Table1[Col6]=Pivot!$J$5,Table1[Col6]=Pivot!...
0
votes
0
answers
58
views
Logical condition equivalent with restrictions
I am developing an Azure DevOps custom task. Part of the setting of the inputs is a VisibleRule which can contain a condition which will determine if the input will be visible, if the condition is ...
9
votes
0
answers
321
views
Limiting the depth of Boolean expressions
I am given a Boolean expression of arbitrary depth, like (A or (B and (C or (~D and E) or F) or (G and H))). There can be any number of terms at each level.
I want to limit the depth of the ...
0
votes
1
answer
67
views
How do i make an onTap toggle Icon to switch between two 'username' and 'Anonymous on Flutter?
I am making a Charity App project, and I am struggling to figure out how to have an anonymous button before someone submits their donation. I want the anonymous option to display before someone ...
0
votes
6
answers
185
views
How to return false if only one specific condition is true and no others? [closed]
In the following (paraphrased) code, I am checking various conditions, updating them, and scheduling a single notification regardless of the number of changed conditions. If none of the conditions are ...
1
vote
1
answer
160
views
Idiomatic alternative for operator logical-and-equals?
C++ has 'accumulator' operations for arithmetic (+,-,*,/) , and for bitwise operations AND and OR - but not for logical operations.
Now, in our code, we sometimes need to conjunct many boolean values -...
1
vote
2
answers
285
views
Simplify a boolean expression with 4 variables to 3 variables
I'm doing some simplifications for a circuit and I ended up getting the following expression:
A.C'.D' + A.B'.C' + B.C.D' + B'.C.D + A'.B'.D'
which translates to the truth table where 0, 2, 3, 6, 8, 9, ...
-1
votes
1
answer
95
views
Is there any better way to write this piece of code? [duplicate]
I am a beginner in this, I was curious if i can write the below code
more efficiently.
I can't use loops or conditional statements, just logical operators.
double a = Double.parseDouble(args[0]...
1
vote
1
answer
152
views
Generate as short as possible boolean formula from a given truth table [closed]
Given a truth table, maybe 3-vars, 5-vars or even 10-vars, i can write its formula in DNF or CNF, and simplify it using K-Map or Quine-McCluskey algorithm. But it is based on {NOT, AND, OR}. Now the ...
0
votes
1
answer
49
views
Invalid Qualifier - For two sets of Boolean Conditions
Hi I'm new to Excel VBA trying to tell the VBA to autocalculate should my autocalculate checkbox be selected.
And if the autocalculate checkbox is selected, to check if the RectanglePerp checkbox is ...
0
votes
1
answer
104
views
How to simplify these clauses into implications for an implication graph?
For a uni project I have to create an implication graph from clauses.
For example, from the clause (a or b), I can determine these implication :
¬a -> b
¬b -> a
but I really can't find the ...
0
votes
0
answers
127
views
LC-3 Assembly OR operation
Displays a newline followed by "Enter First Number (4 binary digits): " as a prompt for the user to input a four-digit binary number.
Accepts user input for the first number, echoing each ...
0
votes
0
answers
60
views
My TempArray always has the wrong values and therefore doesnt evaluate properly and I am confused why
I am writing a program to evaluate a boolean algebra equation such as A'B + C'
Ive tried changing how the temparray is read or created and im not sure what im missing
Im relativey new to this so it ...
0
votes
1
answer
48
views
Trouble with boolean logic in if (else) statements
I am trying to create a function that returns a different greeting depending on two variables: the country and time provided.
If time is greater than or equal to 0 but less than 12 it will be morning. ...
0
votes
0
answers
85
views
Derive conditions for each variable assignment from pseudocode
I have some pseudocode that is in the form:
patch a:
if b == "foo1"
then
a = "No"
if c == "foo2"
then
if d == "foo3" || d == "foo4&...
1
vote
1
answer
322
views
How to output a 5 bit number from a ripple-carry adder/subtractor into a 5 bit decoder to account for overflow in Verilog?
I am working on a project that will take two 4-bit numbers between 0-9 and add/subtract them to be displayed in a seven segment display. Here is a big picture idea of what I am trying to create
My ...
-3
votes
1
answer
53
views
Booleans Values
Which of the following will be fully evaluated that first option will be checked inclusive the second option, if the following variables represent the following boolean values
a = True
b = False
...
0
votes
0
answers
81
views
PySpark filter works incorrectly with one True built using lambda funtion
I was debugging a function and I have encountered a misterious thing:
Given a PySpark dataframe with one column (name_id) I build another (is_number) one using a lambda function to see if name_id is a ...
0
votes
1
answer
426
views
Multisim - AND Gate Always Giving An Output
I recently downloaded Multisim to give it a try. I used it many years ago and recently have a need to design some circuits so it was my first go-to. However, I am run into issues where the ...
2
votes
1
answer
106
views
Application of Monads
The code below provides for testing the satisfiability of a 2-SAT boolean formula (a formula containing just clauses of the form X v Y). Although other algorithms exist (strongly connected components ...
-2
votes
2
answers
63
views
Boolean Logic and For Loops
I was wondering if those familiar with codingbat's problems might be able to help me with understanding the differences between these two solutions and why one doesn't work.
The problem:
Given a ...
2
votes
1
answer
322
views
logic gates to control 2 swiches and 2 lights
I have 2 switches that correspond to 2 lights and I would like to control them with logic gates. My problem starts when a switch is ON and the second one goes into ON as well.
In this condition, I ...