# Simplify Boolean/logical expression

12 Ansichten (letzte 30 Tage)
Sara Nikdel am 14 Aug. 2020
Kommentiert: Sara Nikdel am 14 Aug. 2020
I have the following commands:
syms a b c;
S = simplify( ((a|b) | a) & (a|c) );
When I run them, it gives me the following answer:
(a | b) & (a | c)
which is correct, but it is not the simplest answer. The simplest answer is this:
a | (b & c)
For what I am working on, when 'a' appears two times, it changes the result and calculation. So I get the wrong outputs. I was wondering if there is a way to get the simplest answer such as the second one for a Boolean expression or if I can make changes to the current commands to get the second answer?
Note: This is just an example, I will have about 15-20 elements/sets in my Boolean expression.
##### 0 Kommentare-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Akzeptierte Antwort

Walter Roberson am 14 Aug. 2020
simplify(S, 'steps', 10)
##### 1 KommentarKeine anzeigenKeine ausblenden
Sara Nikdel am 14 Aug. 2020
Thank you

Melden Sie sich an, um zu kommentieren.

### Weitere Antworten (1)

Cris LaPierre am 14 Aug. 2020
You could try using the "Steps" name-value pair
S = simplify( ((a|b) | a) & (a|c) ,"Steps",50)
##### 1 KommentarKeine anzeigenKeine ausblenden
Sara Nikdel am 14 Aug. 2020
Thank you, It worked.

Melden Sie sich an, um zu kommentieren.

### Kategorien

Find more on Logical in Help Center and File Exchange

R2020a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by